ChatWoot icon

ChatWoot

Consume ChatWoot API

Overview

This n8n node integrates with the ChatWoot API to create new contacts. It allows users to programmatically add contact records to their ChatWoot account, including details such as name, email, phone number, and custom attributes. This is useful for automating customer onboarding, syncing external CRM data, or capturing leads from various sources directly into ChatWoot.

Example scenarios:

  • Automatically adding a new customer to ChatWoot when they sign up on your website.
  • Syncing contacts from another CRM or marketing platform into ChatWoot.
  • Enriching ChatWoot contacts with additional metadata via custom attributes.

Properties

Name Type Meaning
Authentication options Selects how to authenticate: either by direct parameters (BaseUrl + Token) or credentials.
BaseUrl string The base URL of your ChatWoot instance (used if "Parameters" authentication is selected).
Access Token string The API token for ChatWoot (used if "Parameters" authentication is selected).
Account ID string (Optional) Reference to a specific ChatWoot account; overrides credentials if provided.
Source ID string Internal source contact identifier, used for search; should be URL-escaped or in HEX format.
Contact Identifier string (Optional) External API contact identifier for the contact being created.
Name string The display name of the contact.
Inbox ID string The inbox to associate the contact with.
Phone Number string The contact's phone number.
E-Mail string The contact's email address.
Custom Attributes fixedCollection Key-value pairs for any additional custom attributes to store with the contact.

Output

The node outputs a JSON object representing the newly created contact. The structure typically includes:

{
  "id": 12345,
  "name": "Contact Name",
  "email": "email@domain.com",
  "phone_number": "+1234567890",
  "inbox_id": "6789",
  "custom_attributes": {
    "key1": "value1",
    "key2": "value2"
  },
  // ...other fields returned by the ChatWoot API
}

If an error occurs and "Continue On Fail" is enabled, the output will include an error field with the error message.

Dependencies

  • ChatWoot API: Requires access to a ChatWoot instance.
  • API Credentials: Either a direct API token and base URL or pre-configured n8n credentials (chatWootTokenApi).
  • n8n Configuration: Ensure that the credentials are set up in n8n if using the predefined credential type.

Troubleshooting

Common Issues:

  • Authentication errors: Occur if the API token or base URL is incorrect. Double-check credentials and permissions.
  • Missing required fields: If mandatory properties like "Name" or "E-Mail" are not provided, the API may reject the request.
  • Invalid custom attributes: Ensure keys and values are properly formatted strings.

Error Messages:

  • "Authentication failed": Check your API token and base URL.
  • "Resource not found": Verify the Account ID, Inbox ID, or other identifiers.
  • "Validation failed": Make sure all required fields are filled and correctly formatted.

Links and References

Discussion