ChatWoot icon

ChatWoot

Interact with ChatWoot API

Actions100

Overview

The Update Agent In Account operation for the Agents resource allows you to update an existing agent's details within a specific account in ChatWoot. This node is useful when you need to programmatically change an agent's role, availability status, or auto-offline settings—such as automating user management workflows, synchronizing agent states with external systems, or bulk-updating agent configurations.

Example scenarios:

  • Automatically set agents to "busy" during scheduled maintenance.
  • Promote an agent to administrator based on performance metrics.
  • Ensure agents are set to go offline automatically after working hours.

Properties

Display Name Type Description
Account Id Number The numeric ID of the account where the agent resides. (Required)
Id Number The ID of the agent to be updated. (Required)
Role Options Whether the agent should be an "Agent" or "Administrator". (Required)
Availability Options The availability setting of the agent: "Available", "Busy", or "Offline".
Auto Offline Boolean Whether the agent's availability status is set to go offline automatically when away.

Output

The node outputs a json object containing the updated agent's information as returned by the ChatWoot API. The structure typically includes fields such as:

{
  "id": 123,
  "account_id": 456,
  "role": "agent",
  "availability": "available",
  "auto_offline": true,
  // ...other agent properties as provided by ChatWoot
}

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: No special environment variables required beyond standard credential setup.

Troubleshooting

Common Issues:

  • Invalid Account or Agent ID: If the provided Account Id or Id does not exist, the API will return an error.
  • Insufficient Permissions: The credentials used must have permission to update agents in the specified account.
  • Incorrect Role or Availability Value: Only allowed values ("agent"/"administrator" for Role; "available"/"busy"/"offline" for Availability) are accepted.

Typical Error Messages:

  • "404 Not Found": The agent or account was not found. Double-check the IDs.
  • "401 Unauthorized": Invalid or missing API credentials. Ensure your chatwootApi credential is correct.
  • "400 Bad Request": One or more input properties are invalid. Verify that all required fields are filled and use only supported option values.

Links and References

Discussion