ChatWoot icon

ChatWoot

Interact with ChatWoot API

Actions100

Overview

This node allows you to add a new custom attribute to an account in ChatWoot. It is useful when you need to extend the data model of accounts with additional fields tailored to your business needs, such as tracking extra metadata or categorizing accounts with custom properties.

Common scenarios:

  • Adding a "Customer Tier" field to accounts for segmentation.
  • Storing custom identifiers or tags on accounts.
  • Enabling advanced filtering and reporting based on custom attributes.

Example:
You want to track the "Onboarding Date" for each account. You can use this node to create a new date-type custom attribute called "Onboarding Date" and assign it to all relevant accounts.


Properties

Display Name Type Description
Account Id Number The numeric ID of the account to which the custom attribute will be added.
Attribute Display Name String The display name of the custom attribute (e.g., "Customer Tier").
Attribute Display Type Number The type of the attribute:
0: text, 1: number, 2: currency, 3: percent, 4: link, 5: date, 6: list, 7: checkbox.
Attribute Description String A description of the custom attribute.
Attribute Key String A unique key value for the attribute (used for API access and identification).
Attribute Values JSON The possible values for the attribute (for list/checkbox types), provided as a JSON array.
Attribute Model Number The attribute model:
0: conversation_attribute, 1: contact_attribute.

Output

The node returns a json object containing the details of the newly created custom attribute as returned by the ChatWoot API. The structure typically includes:

{
  "id": 123,
  "account_id": 456,
  "attribute_display_name": "Customer Tier",
  "attribute_display_type": 6,
  "attribute_description": "Tier of the customer",
  "attribute_key": "customer_tier",
  "attribute_values": ["Gold", "Silver", "Bronze"],
  "attribute_model": 0,
  // ...other fields as provided by the API
}

Note: The exact output fields depend on the ChatWoot API response.


Dependencies

  • External Service: Requires access to a ChatWoot instance.
  • API Credentials: Needs a valid chatwootApi credential configured in n8n, including the base URL and authentication token.
  • n8n Configuration: Ensure that the credentials are set up under the name chatwootApi.

Troubleshooting

Common Issues:

  • Invalid Account Id: If the provided Account Id does not exist, the API may return a "Not Found" error.
  • Duplicate Attribute Key: Attempting to add an attribute with a key that already exists may result in a conflict or validation error.
  • Malformed Attribute Values: Supplying invalid JSON in "Attribute Values" can cause parsing errors.
  • Missing Required Fields: Omitting required fields like "Account Id" or "Attribute Display Name" will result in validation errors.

Error Messages & Resolutions:

  • "400 Bad Request": Check that all required fields are filled and correctly formatted.
  • "401 Unauthorized": Verify that your chatwootApi credentials are correct and have sufficient permissions.
  • "409 Conflict": The attribute key already exists; choose a unique key.

Links and References

Discussion