Agents¶
List and manage agents in an account.
AgentsResource ¶
Bases: BaseResource
Synchronous agents resource.
list ¶
List all agents in the account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
Returns:
| Type | Description |
|---|---|
list[Agent]
|
List of Agent objects |
Raises:
| Type | Description |
|---|---|
ChatwootAuthError
|
If authentication fails |
ChatwootPermissionError
|
If user doesn't have access |
Examples:
get ¶
Get agent details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
agent_id
|
int
|
The agent ID |
required |
Returns:
| Type | Description |
|---|---|
Agent
|
Agent object |
Raises:
| Type | Description |
|---|---|
ChatwootNotFoundError
|
If agent not found |
ChatwootAuthError
|
If authentication fails |
Examples:
add ¶
Add a new agent to the account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
name
|
str
|
Agent's name |
required |
email
|
str
|
Agent's email |
required |
role
|
str
|
Agent's role ('agent' or 'administrator') |
required |
**kwargs
|
Any
|
Additional agent attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Agent
|
Created Agent object |
Raises:
| Type | Description |
|---|---|
ChatwootValidationError
|
If validation fails |
ChatwootAuthError
|
If authentication fails |
Examples:
update ¶
Update agent details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
agent_id
|
int
|
The agent ID |
required |
**kwargs
|
Any
|
Agent attributes to update |
{}
|
Returns:
| Type | Description |
|---|---|
Agent
|
Updated Agent object |
Raises:
| Type | Description |
|---|---|
ChatwootNotFoundError
|
If agent not found |
ChatwootValidationError
|
If validation fails |
Examples:
remove ¶
Remove agent from the account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
agent_id
|
int
|
The agent ID to remove |
required |
Raises:
| Type | Description |
|---|---|
ChatwootNotFoundError
|
If agent not found |
ChatwootPermissionError
|
If user doesn't have permission |
Examples:
AsyncAgentsResource ¶
Bases: AsyncBaseResource
Asynchronous agents resource.
list
async
¶
get
async
¶
Get agent details (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
agent_id
|
int
|
The agent ID |
required |
Returns:
| Type | Description |
|---|---|
Agent
|
Agent object |
add
async
¶
Add a new agent to the account (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
name
|
str
|
Agent's name |
required |
email
|
str
|
Agent's email |
required |
role
|
str
|
Agent's role |
required |
**kwargs
|
Any
|
Additional agent attributes |
{}
|
Returns:
| Type | Description |
|---|---|
Agent
|
Created Agent object |
update
async
¶
Update agent details (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
agent_id
|
int
|
The agent ID |
required |
**kwargs
|
Any
|
Agent attributes to update |
{}
|
Returns:
| Type | Description |
|---|---|
Agent
|
Updated Agent object |
remove
async
¶
Remove agent from the account (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
int
|
The account ID |
required |
agent_id
|
int
|
The agent ID to remove |
required |