ChatWoot icon

ChatWoot

Interact with ChatWoot API

Actions100

Overview

This node allows you to add a new automation rule to a specific account in ChatWoot via its API. Automation rules in ChatWoot enable you to automate actions (like adding labels, sending notifications, etc.) based on certain events and conditions within conversations or messages. This is particularly useful for support teams who want to streamline workflows, such as automatically tagging conversations when certain keywords are detected.

Example scenarios:

  • Automatically label incoming messages containing the word "help" as "support".
  • Trigger actions when a conversation is created or updated.
  • Enable/disable automation rules dynamically.

Properties

Display Name Type Description
Account Id Number The numeric ID of the ChatWoot account where the automation rule will be added.
Name String Rule name. Used to identify the automation rule.
Description String A description about the automation and its actions.
Event Name Options The event that triggers the automation. Options: Conversation Created, Conversation Updated, Message Created.
Active Boolean Enable or disable the automation rule.
Actions JSON Array of actions to perform when the condition matches (e.g., add label).
Conditions JSON Array of conditions that determine when the automation should trigger (e.g., message content contains "help").

Output

The node returns the response from the ChatWoot API after attempting to create the automation rule. The output json field typically includes:

{
  "id": 123,
  "account_id": 1,
  "name": "Add label on message create event",
  "description": "Add label support and sales on message create event if incoming message content contains text help",
  "event_name": "message_created",
  "active": true,
  "actions": [
    {
      "action_name": "add_label",
      "action_params": ["support"]
    }
  ],
  "conditions": [
    {
      "attribute_key": "content",
      "filter_operator": "contains",
      "query_operator": "nil",
      "values": ["help"]
    }
  ]
}
  • All fields reflect the properties sent, plus any additional metadata returned by the API (such as the rule's unique id).

Dependencies

  • External Service: Requires access to a ChatWoot instance with API enabled.
  • API Key: You must provide valid ChatWoot API credentials (chatwootApi) in n8n.
  • n8n Configuration: The base URL for your ChatWoot instance must be set in the credentials.

Troubleshooting

Common issues:

  • Invalid Account Id: If the provided Account Id does not exist, the API will return an error.
  • Malformed JSON in Actions/Conditions: Ensure that the JSON structure for Actions and Conditions is valid. Invalid JSON will cause errors.
  • Missing Required Fields: Omitting required fields like Account Id, Name, or Event Name will result in validation errors from the API.
  • Authentication Errors: Incorrect or missing API credentials will prevent the node from connecting to ChatWoot.

Error messages and resolutions:

  • "Invalid authentication credentials": Check your ChatWoot API key and URL.
  • "Account not found": Verify the Account Id exists in your ChatWoot instance.
  • "Invalid JSON": Double-check the syntax of your Actions and Conditions fields.

Links and References

Discussion