Actions35
- Account Actions
- Canned Response Actions
- Contact Actions
- Conversation Actions
- Inbox Actions
- Label Actions
- Message Actions
- Team Actions
- Webhook Actions
Overview
This node interacts with the Chatwoot API to filter contacts within a specified account using custom filter rules. It allows users to define multiple attribute-based conditions (e.g., filtering contacts by country code or name) combined with logical operators (AND/OR). This operation is useful for segmenting contacts based on specific criteria, such as targeting customers from certain countries or with particular attributes.
Practical examples:
- Filtering contacts whose country code is either "US" or "CA".
- Finding contacts whose names start with "John" and have a specific identifier.
- Segmenting contacts that do not equal a certain email domain.
Properties
| Name | Meaning |
|---|---|
| Account ID | The numeric ID of the account in which to filter contacts. |
| Filter Rules | Custom filter rules to apply. Each rule includes: |
- Attribute Key: The contact attribute to filter on (e.g., name, country_code). |
|
| - Filter Operator: Comparison operator to use. Options: Contains, Ends With, Equal To, Not Equal To, Starts With. | |
| - Values: Comma-separated list of values to compare against. | |
| - Query Operator: Logical operator (AND/OR) to chain this rule with others. | |
| Continue on Fail | Whether to continue execution if the operation fails (boolean). |
Output
The output is an array of JSON objects representing the filtered contacts matching the specified rules. Each item corresponds to one contact object returned by the Chatwoot API's filter endpoint.
Example structure of each output item (json field):
{
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"phone_number": "+1234567890",
"identifier": "unique_id_123",
"custom_attributes": {
"company": "Acme Corp"
},
...
}
No binary data is produced by this operation.
Dependencies
- Requires an active connection to the Chatwoot API.
- Needs an API authentication token configured in n8n credentials for Chatwoot.
- The node makes HTTP POST requests to the
/api/v1/accounts/{accountId}/contacts/filterendpoint.
Troubleshooting
Common issues:
- Invalid or missing Account ID will cause the API request to fail.
- Incorrectly formatted filter rules (e.g., empty attribute keys or invalid operators) may result in errors or no results.
- Network or authentication failures can prevent successful API calls.
Error messages:
- API error messages from Chatwoot will be propagated, e.g., "Account not found" or "Invalid filter parameters".
- If "Continue on Fail" is disabled, the node will stop execution on the first error.
- Enabling "Continue on Fail" will return error details in the output JSON under an
errorkey.
Resolution tips:
- Verify the Account ID is correct and accessible.
- Ensure filter rules are properly defined with valid attribute keys and operators.
- Check API credentials and network connectivity.
- Use "Continue on Fail" cautiously to handle partial failures gracefully.
Links and References
- Chatwoot API Documentation
- n8n Documentation on HTTP Request Node
- n8n Expressions Guide (for dynamic property values)