Compare commits

...
47 changed files with 1711 additions and 0 deletions
@@ -5,6 +5,25 @@ summary: Add a New Agent
description: Add a new Agent to Account description: Add a new Agent to Account
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Add a new agent"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
agent = client.agents.add(
account_id=1,
name="John Doe",
email="john@example.com",
role="agent"
)
print(agent.id, agent.name)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,18 @@ summary: Remove an Agent from Account
description: Remove an Agent from Account description: Remove an Agent from Account
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Remove an agent"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.agents.remove(account_id=1, agent_id=10)
parameters: parameters:
- in: path - in: path
name: id name: id
@@ -5,6 +5,21 @@ summary: List Agents in Account
description: Get Details of Agents in an Account description: Get Details of Agents in an Account
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "List all agents"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
agents = client.agents.list(account_id=1)
for agent in agents:
print(agent.name, agent.role)
responses: responses:
200: 200:
description: Success description: Success
@@ -5,6 +5,25 @@ summary: Update Agent in Account
description: Update an Agent in Account description: Update an Agent in Account
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Update an agent"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
agent = client.agents.update(
account_id=1,
agent_id=10,
name="Jane Doe",
role="administrator"
)
print(agent.id, agent.role)
parameters: parameters:
- in: path - in: path
name: id name: id
@@ -14,6 +14,24 @@ get:
type: number type: number
description: ID of the contact description: ID of the contact
required: true required: true
x-codeSamples:
- lang: python
label: "Get contactable inboxes"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
inboxes = client.contacts.contactable_inboxes(
account_id=1,
contact_id=100
)
for item in inboxes:
print(item["source_id"], item["inbox"]["name"])
responses: responses:
'200': '200':
description: Success description: Success
@@ -22,6 +22,24 @@ get:
description: ID of the contact description: ID of the contact
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Get contact conversations"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversations = client.contacts.conversations(
account_id=1,
contact_id=100
)
for conversation in conversations:
print(conversation.id, conversation.status)
responses: responses:
'200': '200':
description: Success description: Success
@@ -15,6 +15,20 @@ get:
security: security:
- userApiKey: [] - userApiKey: []
description: Get a contact belonging to the account using ID description: Get a contact belonging to the account using ID
x-codeSamples:
- lang: python
label: "Get contact details"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
contact = client.contacts.get(account_id=1, contact_id=100)
print(contact.name, contact.email, contact.phone_number)
responses: responses:
'200': '200':
description: Success description: Success
@@ -43,6 +57,26 @@ put:
security: security:
- userApiKey: [] - userApiKey: []
description: Update a contact belonging to the account using ID description: Update a contact belonging to the account using ID
x-codeSamples:
- lang: python
label: "Update a contact"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
contact = client.contacts.update(
account_id=1,
contact_id=100,
name="Jane Doe",
email="jane@example.com",
custom_attributes={"plan": "premium"}
)
print(contact.id, contact.name)
requestBody: requestBody:
required: true required: true
content: content:
@@ -77,6 +111,18 @@ delete:
security: security:
- userApiKey: [] - userApiKey: []
description: Delete a contact belonging to the account using ID description: Delete a contact belonging to the account using ID
x-codeSamples:
- lang: python
label: "Delete a contact"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.contacts.delete(account_id=1, contact_id=100)
responses: responses:
'200': '200':
description: Success description: Success
@@ -6,6 +6,22 @@ post:
summary: Contact Filter summary: Contact Filter
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Filter contacts"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# Use search to find contacts by name, email, or phone
contacts = client.contacts.search(
account_id=1,
query="example.com"
)
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
- name: page - name: page
@@ -15,6 +15,24 @@ get:
description: Lists all the labels of a contact description: Lists all the labels of a contact
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "List contact labels"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
labels = client.contacts.labels.list(
account_id=1,
contact_id=100
)
print(labels)
# ['vip', 'enterprise']
responses: responses:
'200': '200':
description: Success description: Success
@@ -43,6 +61,26 @@ post:
description: Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation. description: Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation.
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Add labels to contact"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# Note: this overwrites existing labels
labels = client.contacts.labels.add(
account_id=1,
contact_id=100,
labels=["vip", "enterprise"]
)
print(labels)
# ['vip', 'enterprise']
requestBody: requestBody:
required: true required: true
content: content:
@@ -10,6 +10,21 @@ get:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/contact_sort_param' - $ref: '#/components/parameters/contact_sort_param'
- $ref: '#/components/parameters/page' - $ref: '#/components/parameters/page'
x-codeSamples:
- lang: python
label: "List all contacts"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
contacts = client.contacts.list(account_id=1, page=1)
for contact in contacts:
print(contact.name, contact.email)
responses: responses:
'200': '200':
description: Success description: Success
@@ -34,6 +49,26 @@ post:
- userApiKey: [] - userApiKey: []
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
x-codeSamples:
- lang: python
label: "Create a contact"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
result = client.contacts.create(
account_id=1,
inbox_id=5,
name="John Doe",
email="john@example.com",
phone_number="+1234567890"
)
print(result.contact.id, result.contact_inbox.source_id)
requestBody: requestBody:
required: true required: true
content: content:
@@ -10,6 +10,25 @@ description: |
This action is irreversible. All conversations, labels, and custom attributes from the This action is irreversible. All conversations, labels, and custom attributes from the
mergee contact will be moved to the base contact. mergee contact will be moved to the base contact.
x-codeSamples:
- lang: python
label: "Merge two contacts"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# base_contact_id is kept; mergee_contact_id is deleted
contact = client.contacts.merge(
account_id=1,
base_contact_id=100,
mergee_contact_id=200
)
print(contact.id, contact.name)
requestBody: requestBody:
required: true required: true
content: content:
@@ -15,6 +15,35 @@ get:
description: Search using contact `name`, `identifier`, `email` or `phone number` description: Search using contact `name`, `identifier`, `email` or `phone number`
- $ref: '#/components/parameters/contact_sort_param' - $ref: '#/components/parameters/contact_sort_param'
- $ref: '#/components/parameters/page' - $ref: '#/components/parameters/page'
x-codeSamples:
- lang: python
label: "Search by email"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
contacts = client.contacts.search(
account_id=1,
query="john@example.com"
)
for contact in contacts:
print(contact.name, contact.email)
- lang: python
label: "Search by name"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
contacts = client.contacts.search(account_id=1, query="John Doe")
responses: responses:
'200': '200':
description: Success description: Success
@@ -21,6 +21,37 @@ requestBody:
type: number type: number
description: Id of the team. If the assignee_id is present, this param would be ignored description: Id of the team. If the assignee_id is present, this param would be ignored
example: 1 example: 1
x-codeSamples:
- lang: python
label: "Assign to an agent"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.assign(
account_id=1,
conversation_id=42,
assignee_id=10
)
- lang: python
label: "Assign to a team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.update(
account_id=1,
conversation_id=42,
team_id=5
)
responses: responses:
'200': '200':
description: Success description: Success
@@ -40,3 +71,28 @@ responses:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/bad_request_error' $ref: '#/components/schemas/bad_request_error'
x-codeSamples:
- lang: Python
label: Assign to an agent
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(url="https://app.chatwoot.com", api_key="your-api-key")
conversation = client.conversations.assign(
account_id=1,
conversation_id=42,
assignee_id=10
)
- lang: Python
label: Assign to a team
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(url="https://app.chatwoot.com", api_key="your-api-key")
conversation = client.conversations.assign(
account_id=1,
conversation_id=42,
team_id=5
)
@@ -5,6 +5,24 @@ description: Filter conversations with custom filter options and pagination
summary: Conversations Filter summary: Conversations Filter
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Filter conversations"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# Use the list method with built-in filters
conversations = client.conversations.list(
account_id=1,
status="pending",
assignee_type="unassigned",
inbox_id=5
)
parameters: parameters:
- name: page - name: page
in: query in: query
@@ -50,6 +50,43 @@ get:
default: 1 default: 1
description: paginate through conversations description: paginate through conversations
x-codeSamples:
- lang: python
label: "List open conversations"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversations = client.conversations.list(
account_id=1,
status="open",
assignee_type="me",
page=1
)
for conversation in conversations:
print(conversation.id, conversation.status)
- lang: python
label: "Search conversations"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversations = client.conversations.list(
account_id=1,
q="billing issue",
inbox_id=5,
labels=["support"]
)
responses: responses:
'200': '200':
description: Success description: Success
@@ -79,6 +116,25 @@ post:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/conversation_create_payload' $ref: '#/components/schemas/conversation_create_payload'
x-codeSamples:
- lang: python
label: "Create a conversation"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.create(
account_id=1,
source_id="user-123",
inbox_id=5,
contact_id=100
)
print(conversation.id, conversation.inbox_id)
responses: responses:
'200': '200':
description: Success description: Success
@@ -5,6 +5,26 @@ summary: Add Labels
security: security:
- userApiKey: [] - userApiKey: []
description: Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation. description: Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.
x-codeSamples:
- lang: python
label: "Add labels to conversation"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# Note: this overwrites existing labels
labels = client.conversations.labels.add(
account_id=1,
conversation_id=42,
labels=["support", "billing"]
)
print(labels)
# ['support', 'billing']
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,24 @@ summary: List Labels
security: security:
- userApiKey: [] - userApiKey: []
description: Lists all the labels of a conversation description: Lists all the labels of a conversation
x-codeSamples:
- lang: python
label: "List conversation labels"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
labels = client.conversations.labels.list(
account_id=1,
conversation_id=42
)
print(labels)
# ['support', 'billing', 'urgent']
responses: responses:
'200': '200':
description: Success description: Success
@@ -56,6 +56,40 @@ description: |
security: security:
- userApiKey: [] - userApiKey: []
- agentBotApiKey: [] - agentBotApiKey: []
x-codeSamples:
- lang: python
label: "Send a message"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
message = client.messages.create(
account_id=1,
conversation_id=42,
content="Hello, how can I help you today?"
)
print(message.id, message.content)
- lang: python
label: "Send a private note"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
note = client.messages.create(
account_id=1,
conversation_id=42,
content="Internal note: Customer needs follow-up",
private=True
)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,22 @@ summary: Delete a message
security: security:
- userApiKey: [] - userApiKey: []
description: Delete a message and it's attachments from the conversation. description: Delete a message and it's attachments from the conversation.
x-codeSamples:
- lang: python
label: "Delete a message"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.messages.delete(
account_id=1,
conversation_id=42,
message_id=123
)
responses: responses:
'200': '200':
description: Success description: Success
@@ -5,6 +5,24 @@ summary: Get messages
security: security:
- userApiKey: [] - userApiKey: []
description: List all messages of a conversation description: List all messages of a conversation
x-codeSamples:
- lang: python
label: "List messages"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
messages = client.messages.list(
account_id=1,
conversation_id=42
)
for message in messages:
print(message.content, message.message_type)
responses: responses:
'200': '200':
description: Success description: Success
@@ -37,6 +37,25 @@ get:
items: items:
type: string type: string
x-codeSamples:
- lang: python
label: "Get conversation counts"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
counts = client.conversations.get_counts(
account_id=1,
status="open"
)
print(counts)
# {'mine_count': 5, 'unassigned_count': 12, 'assigned_count': 8, 'all_count': 25}
responses: responses:
'200': '200':
description: Success description: Success
@@ -5,6 +5,25 @@ summary: Conversation Details
security: security:
- userApiKey: [] - userApiKey: []
description: Get all details regarding a conversation with all messages in the conversation description: Get all details regarding a conversation with all messages in the conversation
x-codeSamples:
- lang: python
label: "Get conversation details"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.get(
account_id=1,
conversation_id=42
)
print(conversation.id, conversation.status)
print(conversation.meta)
print(conversation.messages)
responses: responses:
'200': '200':
description: Success description: Success
@@ -20,6 +20,22 @@ requestBody:
enum: ['urgent', 'high', 'medium', 'low', 'none'] enum: ['urgent', 'high', 'medium', 'low', 'none']
description: 'The priority of the conversation' description: 'The priority of the conversation'
example: 'high' example: 'high'
x-codeSamples:
- lang: python
label: "Set conversation priority"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.update(
account_id=1,
conversation_id=42,
priority="urgent"
)
responses: responses:
'200': '200':
description: Success description: Success
@@ -33,6 +33,39 @@ requestBody:
customer reply. The conversation always reopens when the customer reply. The conversation always reopens when the
customer replies. customer replies.
example: 1757506877 example: 1757506877
x-codeSamples:
- lang: python
label: "Resolve a conversation"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
result = client.conversations.toggle_status(
account_id=1,
conversation_id=42,
status="resolved"
)
print(result.success, result.current_status)
- lang: python
label: "Reopen a conversation"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
result = client.conversations.toggle_status(
account_id=1,
conversation_id=42,
status="open"
)
responses: responses:
'200': '200':
description: Success description: Success
@@ -22,6 +22,22 @@ requestBody:
type: number type: number
description: 'The ID of the SLA policy (Available only in Enterprise edition)' description: 'The ID of the SLA policy (Available only in Enterprise edition)'
example: 1 example: 1
x-codeSamples:
- lang: python
label: "Update conversation priority"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.update(
account_id=1,
conversation_id=42,
priority="high"
)
responses: responses:
'200': '200':
description: Success description: Success
@@ -8,6 +8,24 @@ post:
- userApiKey: [] - userApiKey: []
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
x-codeSamples:
- lang: python
label: "Create an API inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
inbox = client.inboxes.create(
account_id=1,
name="Support Inbox",
channel_type="api"
)
print(inbox.id, inbox.name)
requestBody: requestBody:
required: true required: true
content: content:
@@ -6,6 +6,21 @@ get:
description: See if an agent bot is associated to the Inbox description: See if an agent bot is associated to the Inbox
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Get inbox agent bot"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
bot = client.inboxes.get_agent_bot(account_id=1, inbox_id=5)
if bot:
print(bot["id"], bot["name"])
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
- name: id - name: id
@@ -5,6 +5,24 @@ summary: Add a New Agent
description: Add a new Agent to Inbox description: Add a new Agent to Inbox
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Add agents to inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
agents = client.inboxes.agents.add(
account_id=1,
inbox_id=5,
agent_ids=[10, 11, 12]
)
print(f"Inbox now has {len(agents)} agents")
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,22 @@ summary: Remove an Agent from Inbox
description: Remove an Agent from Inbox description: Remove an Agent from Inbox
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Remove agents from inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.inboxes.agents.remove(
account_id=1,
inbox_id=5,
agent_ids=[10]
)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,21 @@ summary: List Agents in Inbox
description: Get Details of Agents in an Inbox description: Get Details of Agents in an Inbox
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "List agents in inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
agents = client.inboxes.agents.list(account_id=1, inbox_id=5)
for agent in agents:
print(agent.name, agent.email)
parameters: parameters:
- $ref: '#/components/parameters/inbox_id' - $ref: '#/components/parameters/inbox_id'
responses: responses:
@@ -5,6 +5,25 @@ summary: Update Agents in Inbox
description: All agents except the one passed in params will be removed description: All agents except the one passed in params will be removed
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Replace all agents in inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# Replaces ALL current agents — agents not in this list are removed
agents = client.inboxes.agents.update(
account_id=1,
inbox_id=5,
agent_ids=[10, 11]
)
print(f"Inbox now has {len(agents)} agents")
requestBody: requestBody:
required: true required: true
content: content:
@@ -8,6 +8,21 @@ get:
- userApiKey: [] - userApiKey: []
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
x-codeSamples:
- lang: python
label: "List all inboxes"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
inboxes = client.inboxes.list(account_id=1)
for inbox in inboxes:
print(inbox.id, inbox.name)
responses: responses:
'200': '200':
description: Success description: Success
@@ -6,6 +6,29 @@ post:
security: security:
- userApiKey: [] - userApiKey: []
description: To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null description: To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null
x-codeSamples:
- lang: python
label: "Assign an agent bot"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.inboxes.set_agent_bot(account_id=1, inbox_id=5, agent_bot_id=2)
- lang: python
label: "Remove agent bot"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.inboxes.set_agent_bot(account_id=1, inbox_id=5, agent_bot_id=None)
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
- name: id - name: id
@@ -14,6 +14,20 @@ get:
type: number type: number
description: ID of the inbox description: ID of the inbox
required: true required: true
x-codeSamples:
- lang: python
label: "Get an inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
inbox = client.inboxes.get(account_id=1, inbox_id=5)
print(inbox.name, inbox.channel_type)
responses: responses:
'200': '200':
description: Success description: Success
@@ -14,6 +14,25 @@ patch:
type: number type: number
description: ID of the inbox description: ID of the inbox
required: true required: true
x-codeSamples:
- lang: python
label: "Update an inbox"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
inbox = client.inboxes.update(
account_id=1,
inbox_id=5,
name="Updated Inbox Name",
enable_auto_assignment=True
)
print(inbox.id, inbox.name)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,22 @@ summary: Add a New Agent
description: Add a new Agent to Team description: Add a new Agent to Team
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Add agents to team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.teams.agents.add(
account_id=1,
team_id=5,
agent_ids=[10, 11, 12]
)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,22 @@ summary: Remove an Agent from Team
description: Remove an Agent from Team description: Remove an Agent from Team
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Remove agents from team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.teams.agents.remove(
account_id=1,
team_id=5,
agent_ids=[10]
)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,21 @@ summary: List Agents in Team
description: Get Details of Agents in an Team description: Get Details of Agents in an Team
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "List agents in team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
agents = client.teams.agents.list(account_id=1, team_id=5)
for agent in agents:
print(agent.name, agent.email)
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/team_id' - $ref: '#/components/parameters/team_id'
@@ -5,6 +5,23 @@ summary: Update Agents in Team
description: All agents except the one passed in params will be removed description: All agents except the one passed in params will be removed
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Replace team agents"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
# Replaces all current agents with the ones provided
agents = client.teams.agents.update(
account_id=1,
team_id=5,
agent_ids=[10, 11]
)
requestBody: requestBody:
required: true required: true
content: content:
@@ -7,6 +7,25 @@ security:
description: Create a team in the account description: Create a team in the account
parameters: parameters:
- $ref: '#/components/parameters/account_id' - $ref: '#/components/parameters/account_id'
x-codeSamples:
- lang: python
label: "Create a team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
team = client.teams.create(
account_id=1,
name="Support Team",
description="Customer support team",
allow_auto_assign=True
)
print(team.id, team.name)
requestBody: requestBody:
required: true required: true
content: content:
@@ -5,6 +5,18 @@ summary: Delete a team
security: security:
- userApiKey: [] - userApiKey: []
description: Delete a team from the account description: Delete a team from the account
x-codeSamples:
- lang: python
label: "Delete a team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
client.teams.delete(account_id=1, team_id=5)
responses: responses:
'200': '200':
description: Success description: Success
+15
View File
@@ -5,6 +5,21 @@ summary: List all teams
security: security:
- userApiKey: [] - userApiKey: []
description: List all teams available in the current account description: List all teams available in the current account
x-codeSamples:
- lang: python
label: "List all teams"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
teams = client.teams.list(account_id=1)
for team in teams:
print(team.id, team.name)
responses: responses:
'200': '200':
description: Success description: Success
+14
View File
@@ -5,6 +5,20 @@ summary: Get a team details
security: security:
- userApiKey: [] - userApiKey: []
description: Get the details of a team in the account description: Get the details of a team in the account
x-codeSamples:
- lang: python
label: "Get a team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
team = client.teams.get(account_id=1, team_id=5)
print(team.name, team.description)
responses: responses:
'200': '200':
description: Success description: Success
@@ -5,6 +5,24 @@ summary: Update a team
security: security:
- userApiKey: [] - userApiKey: []
description: Update a team's attributes description: Update a team's attributes
x-codeSamples:
- lang: python
label: "Update a team"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
team = client.teams.update(
account_id=1,
team_id=5,
name="New Team Name"
)
print(team.id, team.name)
requestBody: requestBody:
required: true required: true
content: content:
+14
View File
@@ -6,6 +6,20 @@ get:
description: Get the user profile details description: Get the user profile details
security: security:
- userApiKey: [] - userApiKey: []
x-codeSamples:
- lang: python
label: "Fetch profile"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
profile = client.profile.get()
print(profile.name, profile.email)
responses: responses:
'200': '200':
description: Success description: Success
+380
View File
@@ -1943,6 +1943,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List all agents",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.agents.list(account_id=1)\n\nfor agent in agents:\n print(agent.name, agent.role)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1982,6 +1989,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add a new agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagent = client.agents.add(\n account_id=1,\n name=\"John Doe\",\n email=\"john@example.com\",\n role=\"agent\"\n)\n\nprint(agent.id, agent.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -2034,6 +2048,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Update an agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagent = client.agents.update(\n account_id=1,\n agent_id=10,\n name=\"Jane Doe\",\n role=\"administrator\"\n)\n\nprint(agent.id, agent.role)\n"
}
],
"parameters": [ "parameters": [
{ {
"in": "path", "in": "path",
@@ -2100,6 +2121,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Remove an agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.agents.remove(account_id=1, agent_id=10)\n"
}
],
"parameters": [ "parameters": [
{ {
"in": "path", "in": "path",
@@ -2674,6 +2702,13 @@
"$ref": "#/components/parameters/page" "$ref": "#/components/parameters/page"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List all contacts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontacts = client.contacts.list(account_id=1, page=1)\n\nfor contact in contacts:\n print(contact.name, contact.email)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -2714,6 +2749,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Create a contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nresult = client.contacts.create(\n account_id=1,\n inbox_id=5,\n name=\"John Doe\",\n email=\"john@example.com\",\n phone_number=\"+1234567890\"\n)\n\nprint(result.contact.id, result.contact_inbox.source_id)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -2775,6 +2817,13 @@
} }
], ],
"description": "Get a contact belonging to the account using ID", "description": "Get a contact belonging to the account using ID",
"x-codeSamples": [
{
"lang": "python",
"label": "Get contact details",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontact = client.contacts.get(account_id=1, contact_id=100)\n\nprint(contact.name, contact.email, contact.phone_number)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -2820,6 +2869,13 @@
} }
], ],
"description": "Update a contact belonging to the account using ID", "description": "Update a contact belonging to the account using ID",
"x-codeSamples": [
{
"lang": "python",
"label": "Update a contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontact = client.contacts.update(\n account_id=1,\n contact_id=100,\n name=\"Jane Doe\",\n email=\"jane@example.com\",\n custom_attributes={\"plan\": \"premium\"}\n)\n\nprint(contact.id, contact.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -2875,6 +2931,13 @@
} }
], ],
"description": "Delete a contact belonging to the account using ID", "description": "Delete a contact belonging to the account using ID",
"x-codeSamples": [
{
"lang": "python",
"label": "Delete a contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.contacts.delete(account_id=1, contact_id=100)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -2940,6 +3003,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get contact conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversations = client.contacts.conversations(\n account_id=1,\n contact_id=100\n)\n\nfor conversation in conversations:\n print(conversation.id, conversation.status)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3001,6 +3071,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List contact labels",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nlabels = client.contacts.labels.list(\n account_id=1,\n contact_id=100\n)\n\nprint(labels)\n# ['vip', 'enterprise']\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3046,6 +3123,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add labels to contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Note: this overwrites existing labels\nlabels = client.contacts.labels.add(\n account_id=1,\n contact_id=100,\n labels=[\"vip\", \"enterprise\"]\n)\n\nprint(labels)\n# ['vip', 'enterprise']\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -3138,6 +3222,18 @@
"$ref": "#/components/parameters/page" "$ref": "#/components/parameters/page"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Search by email",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontacts = client.contacts.search(\n account_id=1,\n query=\"john@example.com\"\n)\n\nfor contact in contacts:\n print(contact.name, contact.email)\n"
},
{
"lang": "python",
"label": "Search by name",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontacts = client.contacts.search(account_id=1, query=\"John Doe\")\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3175,6 +3271,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Filter contacts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Use search to find contacts by name, email, or phone\ncontacts = client.contacts.search(\n account_id=1,\n query=\"example.com\"\n)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -3390,6 +3493,13 @@
"required": true "required": true
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get contactable inboxes",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninboxes = client.contacts.contactable_inboxes(\n account_id=1,\n contact_id=100\n)\n\nfor item in inboxes:\n print(item[\"source_id\"], item[\"inbox\"][\"name\"])\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3442,6 +3552,13 @@
} }
], ],
"description": "Merge two contacts into a single contact. The base contact remains and receives all\ndata from the mergee contact. After the merge, the mergee contact is permanently deleted.\n\nThis action is irreversible. All conversations, labels, and custom attributes from the\nmergee contact will be moved to the base contact.\n", "description": "Merge two contacts into a single contact. The base contact remains and receives all\ndata from the mergee contact. After the merge, the mergee contact is permanently deleted.\n\nThis action is irreversible. All conversations, labels, and custom attributes from the\nmergee contact will be moved to the base contact.\n",
"x-codeSamples": [
{
"lang": "python",
"label": "Merge two contacts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# base_contact_id is kept; mergee_contact_id is deleted\ncontact = client.contacts.merge(\n account_id=1,\n base_contact_id=100,\n mergee_contact_id=200\n)\n\nprint(contact.id, contact.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4282,6 +4399,13 @@
} }
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get conversation counts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncounts = client.conversations.get_counts(\n account_id=1,\n status=\"open\"\n)\n\nprint(counts)\n# {'mine_count': 5, 'unassigned_count': 12, 'assigned_count': 8, 'all_count': 25}\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -4417,6 +4541,18 @@
"description": "paginate through conversations" "description": "paginate through conversations"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List open conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversations = client.conversations.list(\n account_id=1,\n status=\"open\",\n assignee_type=\"me\",\n page=1\n)\n\nfor conversation in conversations:\n print(conversation.id, conversation.status)\n"
},
{
"lang": "python",
"label": "Search conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversations = client.conversations.list(\n account_id=1,\n q=\"billing issue\",\n inbox_id=5,\n labels=[\"support\"]\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -4465,6 +4601,13 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Create a conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.create(\n account_id=1,\n source_id=\"user-123\",\n inbox_id=5,\n contact_id=100\n)\n\nprint(conversation.id, conversation.inbox_id)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -4521,6 +4664,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Filter conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Use the list method with built-in filters\nconversations = client.conversations.list(\n account_id=1,\n status=\"pending\",\n assignee_type=\"unassigned\",\n inbox_id=5\n)\n"
}
],
"parameters": [ "parameters": [
{ {
"name": "page", "name": "page",
@@ -4642,6 +4792,13 @@
} }
], ],
"description": "Get all details regarding a conversation with all messages in the conversation", "description": "Get all details regarding a conversation with all messages in the conversation",
"x-codeSamples": [
{
"lang": "python",
"label": "Get conversation details",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.get(\n account_id=1,\n conversation_id=42\n)\n\nprint(conversation.id, conversation.status)\nprint(conversation.meta)\nprint(conversation.messages)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -4719,6 +4876,13 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Update conversation priority",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.update(\n account_id=1,\n conversation_id=42,\n priority=\"high\"\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -4801,6 +4965,18 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Resolve a conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nresult = client.conversations.toggle_status(\n account_id=1,\n conversation_id=42,\n status=\"resolved\"\n)\n\nprint(result.success, result.current_status)\n"
},
{
"lang": "python",
"label": "Reopen a conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nresult = client.conversations.toggle_status(\n account_id=1,\n conversation_id=42,\n status=\"open\"\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -4911,6 +5087,13 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Set conversation priority",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.update(\n account_id=1,\n conversation_id=42,\n priority=\"urgent\"\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -5068,6 +5251,18 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Assign to an agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.assign(\n account_id=1,\n conversation_id=42,\n assignee_id=10\n)\n"
},
{
"lang": "python",
"label": "Assign to a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.update(\n account_id=1,\n conversation_id=42,\n team_id=5\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5123,6 +5318,13 @@
} }
], ],
"description": "Lists all the labels of a conversation", "description": "Lists all the labels of a conversation",
"x-codeSamples": [
{
"lang": "python",
"label": "List conversation labels",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nlabels = client.conversations.labels.list(\n account_id=1,\n conversation_id=42\n)\n\nprint(labels)\n# ['support', 'billing', 'urgent']\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5168,6 +5370,13 @@
} }
], ],
"description": "Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.", "description": "Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.",
"x-codeSamples": [
{
"lang": "python",
"label": "Add labels to conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Note: this overwrites existing labels\nlabels = client.conversations.labels.add(\n account_id=1,\n conversation_id=42,\n labels=[\"support\", \"billing\"]\n)\n\nprint(labels)\n# ['support', 'billing']\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5305,6 +5514,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List all inboxes",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninboxes = client.inboxes.list(account_id=1)\n\nfor inbox in inboxes:\n print(inbox.id, inbox.name)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5375,6 +5591,13 @@
"required": true "required": true
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get an inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninbox = client.inboxes.get(account_id=1, inbox_id=5)\n\nprint(inbox.name, inbox.channel_type)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5427,6 +5650,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Create an API inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninbox = client.inboxes.create(\n account_id=1,\n name=\"Support Inbox\",\n channel_type=\"api\"\n)\n\nprint(inbox.id, inbox.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5498,6 +5728,13 @@
"required": true "required": true
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Update an inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninbox = client.inboxes.update(\n account_id=1,\n inbox_id=5,\n name=\"Updated Inbox Name\",\n enable_auto_assignment=True\n)\n\nprint(inbox.id, inbox.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5555,6 +5792,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get inbox agent bot",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nbot = client.inboxes.get_agent_bot(account_id=1, inbox_id=5)\n\nif bot:\n print(bot[\"id\"], bot[\"name\"])\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -5616,6 +5860,18 @@
} }
], ],
"description": "To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null", "description": "To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null",
"x-codeSamples": [
{
"lang": "python",
"label": "Assign an agent bot",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.inboxes.set_agent_bot(account_id=1, inbox_id=5, agent_bot_id=2)\n"
},
{
"lang": "python",
"label": "Remove agent bot",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.inboxes.set_agent_bot(account_id=1, inbox_id=5, agent_bot_id=None)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -5698,6 +5954,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List agents in inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.inboxes.agents.list(account_id=1, inbox_id=5)\n\nfor agent in agents:\n print(agent.name, agent.email)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/inbox_id" "$ref": "#/components/parameters/inbox_id"
@@ -5764,6 +6027,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add agents to inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.inboxes.agents.add(\n account_id=1,\n inbox_id=5,\n agent_ids=[10, 11, 12]\n)\n\nprint(f\"Inbox now has {len(agents)} agents\")\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5859,6 +6129,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Replace all agents in inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Replaces ALL current agents — agents not in this list are removed\nagents = client.inboxes.agents.update(\n account_id=1,\n inbox_id=5,\n agent_ids=[10, 11]\n)\n\nprint(f\"Inbox now has {len(agents)} agents\")\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5954,6 +6231,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Remove agents from inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.inboxes.agents.remove(\n account_id=1,\n inbox_id=5,\n agent_ids=[10]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -6039,6 +6323,13 @@
} }
], ],
"description": "List all messages of a conversation", "description": "List all messages of a conversation",
"x-codeSamples": [
{
"lang": "python",
"label": "List messages",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nmessages = client.messages.list(\n account_id=1,\n conversation_id=42\n)\n\nfor message in messages:\n print(message.content, message.message_type)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -6124,6 +6415,18 @@
"agentBotApiKey": [] "agentBotApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Send a message",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nmessage = client.messages.create(\n account_id=1,\n conversation_id=42,\n content=\"Hello, how can I help you today?\"\n)\n\nprint(message.id, message.content)\n"
},
{
"lang": "python",
"label": "Send a private note",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nnote = client.messages.create(\n account_id=1,\n conversation_id=42,\n content=\"Internal note: Customer needs follow-up\",\n private=True\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -6199,6 +6502,13 @@
} }
], ],
"description": "Delete a message and it's attachments from the conversation.", "description": "Delete a message and it's attachments from the conversation.",
"x-codeSamples": [
{
"lang": "python",
"label": "Delete a message",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.messages.delete(\n account_id=1,\n message_id=123\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -6453,6 +6763,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Fetch profile",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nprofile = client.profile.get()\n\nprint(profile.name, profile.email)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -6495,6 +6812,13 @@
} }
], ],
"description": "List all teams available in the current account", "description": "List all teams available in the current account",
"x-codeSamples": [
{
"lang": "python",
"label": "List all teams",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteams = client.teams.list(account_id=1)\n\nfor team in teams:\n print(team.id, team.name)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -6539,6 +6863,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Create a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteam = client.teams.create(\n account_id=1,\n name=\"Support Team\",\n description=\"Customer support team\",\n allow_auto_assign=True\n)\n\nprint(team.id, team.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -6594,6 +6925,13 @@
} }
], ],
"description": "Get the details of a team in the account", "description": "Get the details of a team in the account",
"x-codeSamples": [
{
"lang": "python",
"label": "Get a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteam = client.teams.get(account_id=1, team_id=5)\n\nprint(team.name, team.description)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -6639,6 +6977,13 @@
} }
], ],
"description": "Update a team's attributes", "description": "Update a team's attributes",
"x-codeSamples": [
{
"lang": "python",
"label": "Update a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteam = client.teams.update(\n account_id=1,\n team_id=5,\n name=\"New Team Name\"\n)\n\nprint(team.id, team.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -6684,6 +7029,13 @@
} }
], ],
"description": "Delete a team from the account", "description": "Delete a team from the account",
"x-codeSamples": [
{
"lang": "python",
"label": "Delete a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.teams.delete(account_id=1, team_id=5)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -6732,6 +7084,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List agents in team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.teams.agents.list(account_id=1, team_id=5)\n\nfor agent in agents:\n print(agent.name, agent.email)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -6789,6 +7148,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add agents to team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.teams.agents.add(\n account_id=1,\n team_id=5,\n agent_ids=[10, 11, 12]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -6873,6 +7239,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Replace team agents",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Replaces all current agents with the ones provided\nclient.teams.agents.add(\n account_id=1,\n team_id=5,\n agent_ids=[10, 11]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -6957,6 +7330,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Remove agents from team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.teams.agents.remove(\n account_id=1,\n team_id=5,\n agent_ids=[10]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
+380
View File
@@ -486,6 +486,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List all agents",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.agents.list(account_id=1)\n\nfor agent in agents:\n print(agent.name, agent.role)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -525,6 +532,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add a new agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagent = client.agents.add(\n account_id=1,\n name=\"John Doe\",\n email=\"john@example.com\",\n role=\"agent\"\n)\n\nprint(agent.id, agent.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -577,6 +591,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Update an agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagent = client.agents.update(\n account_id=1,\n agent_id=10,\n name=\"Jane Doe\",\n role=\"administrator\"\n)\n\nprint(agent.id, agent.role)\n"
}
],
"parameters": [ "parameters": [
{ {
"in": "path", "in": "path",
@@ -643,6 +664,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Remove an agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.agents.remove(account_id=1, agent_id=10)\n"
}
],
"parameters": [ "parameters": [
{ {
"in": "path", "in": "path",
@@ -1217,6 +1245,13 @@
"$ref": "#/components/parameters/page" "$ref": "#/components/parameters/page"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List all contacts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontacts = client.contacts.list(account_id=1, page=1)\n\nfor contact in contacts:\n print(contact.name, contact.email)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1257,6 +1292,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Create a contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nresult = client.contacts.create(\n account_id=1,\n inbox_id=5,\n name=\"John Doe\",\n email=\"john@example.com\",\n phone_number=\"+1234567890\"\n)\n\nprint(result.contact.id, result.contact_inbox.source_id)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -1318,6 +1360,13 @@
} }
], ],
"description": "Get a contact belonging to the account using ID", "description": "Get a contact belonging to the account using ID",
"x-codeSamples": [
{
"lang": "python",
"label": "Get contact details",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontact = client.contacts.get(account_id=1, contact_id=100)\n\nprint(contact.name, contact.email, contact.phone_number)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1363,6 +1412,13 @@
} }
], ],
"description": "Update a contact belonging to the account using ID", "description": "Update a contact belonging to the account using ID",
"x-codeSamples": [
{
"lang": "python",
"label": "Update a contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontact = client.contacts.update(\n account_id=1,\n contact_id=100,\n name=\"Jane Doe\",\n email=\"jane@example.com\",\n custom_attributes={\"plan\": \"premium\"}\n)\n\nprint(contact.id, contact.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -1418,6 +1474,13 @@
} }
], ],
"description": "Delete a contact belonging to the account using ID", "description": "Delete a contact belonging to the account using ID",
"x-codeSamples": [
{
"lang": "python",
"label": "Delete a contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.contacts.delete(account_id=1, contact_id=100)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -1483,6 +1546,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get contact conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversations = client.contacts.conversations(\n account_id=1,\n contact_id=100\n)\n\nfor conversation in conversations:\n print(conversation.id, conversation.status)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1544,6 +1614,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List contact labels",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nlabels = client.contacts.labels.list(\n account_id=1,\n contact_id=100\n)\n\nprint(labels)\n# ['vip', 'enterprise']\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1589,6 +1666,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add labels to contact",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Note: this overwrites existing labels\nlabels = client.contacts.labels.add(\n account_id=1,\n contact_id=100,\n labels=[\"vip\", \"enterprise\"]\n)\n\nprint(labels)\n# ['vip', 'enterprise']\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -1681,6 +1765,18 @@
"$ref": "#/components/parameters/page" "$ref": "#/components/parameters/page"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Search by email",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontacts = client.contacts.search(\n account_id=1,\n query=\"john@example.com\"\n)\n\nfor contact in contacts:\n print(contact.name, contact.email)\n"
},
{
"lang": "python",
"label": "Search by name",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncontacts = client.contacts.search(account_id=1, query=\"John Doe\")\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1718,6 +1814,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Filter contacts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Use search to find contacts by name, email, or phone\ncontacts = client.contacts.search(\n account_id=1,\n query=\"example.com\"\n)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -1933,6 +2036,13 @@
"required": true "required": true
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get contactable inboxes",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninboxes = client.contacts.contactable_inboxes(\n account_id=1,\n contact_id=100\n)\n\nfor item in inboxes:\n print(item[\"source_id\"], item[\"inbox\"][\"name\"])\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -1985,6 +2095,13 @@
} }
], ],
"description": "Merge two contacts into a single contact. The base contact remains and receives all\ndata from the mergee contact. After the merge, the mergee contact is permanently deleted.\n\nThis action is irreversible. All conversations, labels, and custom attributes from the\nmergee contact will be moved to the base contact.\n", "description": "Merge two contacts into a single contact. The base contact remains and receives all\ndata from the mergee contact. After the merge, the mergee contact is permanently deleted.\n\nThis action is irreversible. All conversations, labels, and custom attributes from the\nmergee contact will be moved to the base contact.\n",
"x-codeSamples": [
{
"lang": "python",
"label": "Merge two contacts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# base_contact_id is kept; mergee_contact_id is deleted\ncontact = client.contacts.merge(\n account_id=1,\n base_contact_id=100,\n mergee_contact_id=200\n)\n\nprint(contact.id, contact.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -2825,6 +2942,13 @@
} }
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get conversation counts",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ncounts = client.conversations.get_counts(\n account_id=1,\n status=\"open\"\n)\n\nprint(counts)\n# {'mine_count': 5, 'unassigned_count': 12, 'assigned_count': 8, 'all_count': 25}\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -2960,6 +3084,18 @@
"description": "paginate through conversations" "description": "paginate through conversations"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List open conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversations = client.conversations.list(\n account_id=1,\n status=\"open\",\n assignee_type=\"me\",\n page=1\n)\n\nfor conversation in conversations:\n print(conversation.id, conversation.status)\n"
},
{
"lang": "python",
"label": "Search conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversations = client.conversations.list(\n account_id=1,\n q=\"billing issue\",\n inbox_id=5,\n labels=[\"support\"]\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3008,6 +3144,13 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Create a conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.create(\n account_id=1,\n source_id=\"user-123\",\n inbox_id=5,\n contact_id=100\n)\n\nprint(conversation.id, conversation.inbox_id)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3064,6 +3207,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Filter conversations",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Use the list method with built-in filters\nconversations = client.conversations.list(\n account_id=1,\n status=\"pending\",\n assignee_type=\"unassigned\",\n inbox_id=5\n)\n"
}
],
"parameters": [ "parameters": [
{ {
"name": "page", "name": "page",
@@ -3185,6 +3335,13 @@
} }
], ],
"description": "Get all details regarding a conversation with all messages in the conversation", "description": "Get all details regarding a conversation with all messages in the conversation",
"x-codeSamples": [
{
"lang": "python",
"label": "Get conversation details",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.get(\n account_id=1,\n conversation_id=42\n)\n\nprint(conversation.id, conversation.status)\nprint(conversation.meta)\nprint(conversation.messages)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3262,6 +3419,13 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Update conversation priority",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.update(\n account_id=1,\n conversation_id=42,\n priority=\"high\"\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -3344,6 +3508,18 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Resolve a conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nresult = client.conversations.toggle_status(\n account_id=1,\n conversation_id=42,\n status=\"resolved\"\n)\n\nprint(result.success, result.current_status)\n"
},
{
"lang": "python",
"label": "Reopen a conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nresult = client.conversations.toggle_status(\n account_id=1,\n conversation_id=42,\n status=\"open\"\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3454,6 +3630,13 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Set conversation priority",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.update(\n account_id=1,\n conversation_id=42,\n priority=\"urgent\"\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -3611,6 +3794,18 @@
} }
} }
}, },
"x-codeSamples": [
{
"lang": "python",
"label": "Assign to an agent",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.assign(\n account_id=1,\n conversation_id=42,\n assignee_id=10\n)\n"
},
{
"lang": "python",
"label": "Assign to a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nconversation = client.conversations.update(\n account_id=1,\n conversation_id=42,\n team_id=5\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3666,6 +3861,13 @@
} }
], ],
"description": "Lists all the labels of a conversation", "description": "Lists all the labels of a conversation",
"x-codeSamples": [
{
"lang": "python",
"label": "List conversation labels",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nlabels = client.conversations.labels.list(\n account_id=1,\n conversation_id=42\n)\n\nprint(labels)\n# ['support', 'billing', 'urgent']\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3711,6 +3913,13 @@
} }
], ],
"description": "Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.", "description": "Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.",
"x-codeSamples": [
{
"lang": "python",
"label": "Add labels to conversation",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Note: this overwrites existing labels\nlabels = client.conversations.labels.add(\n account_id=1,\n conversation_id=42,\n labels=[\"support\", \"billing\"]\n)\n\nprint(labels)\n# ['support', 'billing']\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -3848,6 +4057,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List all inboxes",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninboxes = client.inboxes.list(account_id=1)\n\nfor inbox in inboxes:\n print(inbox.id, inbox.name)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3918,6 +4134,13 @@
"required": true "required": true
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get an inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninbox = client.inboxes.get(account_id=1, inbox_id=5)\n\nprint(inbox.name, inbox.channel_type)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -3970,6 +4193,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Create an API inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninbox = client.inboxes.create(\n account_id=1,\n name=\"Support Inbox\",\n channel_type=\"api\"\n)\n\nprint(inbox.id, inbox.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4041,6 +4271,13 @@
"required": true "required": true
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Update an inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\ninbox = client.inboxes.update(\n account_id=1,\n inbox_id=5,\n name=\"Updated Inbox Name\",\n enable_auto_assignment=True\n)\n\nprint(inbox.id, inbox.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4098,6 +4335,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Get inbox agent bot",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nbot = client.inboxes.get_agent_bot(account_id=1, inbox_id=5)\n\nif bot:\n print(bot[\"id\"], bot[\"name\"])\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -4159,6 +4403,18 @@
} }
], ],
"description": "To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null", "description": "To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null",
"x-codeSamples": [
{
"lang": "python",
"label": "Assign an agent bot",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.inboxes.set_agent_bot(account_id=1, inbox_id=5, agent_bot_id=2)\n"
},
{
"lang": "python",
"label": "Remove agent bot",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.inboxes.set_agent_bot(account_id=1, inbox_id=5, agent_bot_id=None)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -4241,6 +4497,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List agents in inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.inboxes.agents.list(account_id=1, inbox_id=5)\n\nfor agent in agents:\n print(agent.name, agent.email)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/inbox_id" "$ref": "#/components/parameters/inbox_id"
@@ -4307,6 +4570,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add agents to inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.inboxes.agents.add(\n account_id=1,\n inbox_id=5,\n agent_ids=[10, 11, 12]\n)\n\nprint(f\"Inbox now has {len(agents)} agents\")\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4402,6 +4672,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Replace all agents in inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Replaces ALL current agents — agents not in this list are removed\nagents = client.inboxes.agents.update(\n account_id=1,\n inbox_id=5,\n agent_ids=[10, 11]\n)\n\nprint(f\"Inbox now has {len(agents)} agents\")\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4497,6 +4774,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Remove agents from inbox",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.inboxes.agents.remove(\n account_id=1,\n inbox_id=5,\n agent_ids=[10]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4582,6 +4866,13 @@
} }
], ],
"description": "List all messages of a conversation", "description": "List all messages of a conversation",
"x-codeSamples": [
{
"lang": "python",
"label": "List messages",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nmessages = client.messages.list(\n account_id=1,\n conversation_id=42\n)\n\nfor message in messages:\n print(message.content, message.message_type)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -4667,6 +4958,18 @@
"agentBotApiKey": [] "agentBotApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Send a message",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nmessage = client.messages.create(\n account_id=1,\n conversation_id=42,\n content=\"Hello, how can I help you today?\"\n)\n\nprint(message.id, message.content)\n"
},
{
"lang": "python",
"label": "Send a private note",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nnote = client.messages.create(\n account_id=1,\n conversation_id=42,\n content=\"Internal note: Customer needs follow-up\",\n private=True\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -4742,6 +5045,13 @@
} }
], ],
"description": "Delete a message and it's attachments from the conversation.", "description": "Delete a message and it's attachments from the conversation.",
"x-codeSamples": [
{
"lang": "python",
"label": "Delete a message",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.messages.delete(\n account_id=1,\n message_id=123\n)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -4996,6 +5306,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Fetch profile",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nprofile = client.profile.get()\n\nprint(profile.name, profile.email)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5038,6 +5355,13 @@
} }
], ],
"description": "List all teams available in the current account", "description": "List all teams available in the current account",
"x-codeSamples": [
{
"lang": "python",
"label": "List all teams",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteams = client.teams.list(account_id=1)\n\nfor team in teams:\n print(team.id, team.name)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5082,6 +5406,13 @@
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Create a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteam = client.teams.create(\n account_id=1,\n name=\"Support Team\",\n description=\"Customer support team\",\n allow_auto_assign=True\n)\n\nprint(team.id, team.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5137,6 +5468,13 @@
} }
], ],
"description": "Get the details of a team in the account", "description": "Get the details of a team in the account",
"x-codeSamples": [
{
"lang": "python",
"label": "Get a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteam = client.teams.get(account_id=1, team_id=5)\n\nprint(team.name, team.description)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success", "description": "Success",
@@ -5182,6 +5520,13 @@
} }
], ],
"description": "Update a team's attributes", "description": "Update a team's attributes",
"x-codeSamples": [
{
"lang": "python",
"label": "Update a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nteam = client.teams.update(\n account_id=1,\n team_id=5,\n name=\"New Team Name\"\n)\n\nprint(team.id, team.name)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5227,6 +5572,13 @@
} }
], ],
"description": "Delete a team from the account", "description": "Delete a team from the account",
"x-codeSamples": [
{
"lang": "python",
"label": "Delete a team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.teams.delete(account_id=1, team_id=5)\n"
}
],
"responses": { "responses": {
"200": { "200": {
"description": "Success" "description": "Success"
@@ -5275,6 +5627,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "List agents in team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nagents = client.teams.agents.list(account_id=1, team_id=5)\n\nfor agent in agents:\n print(agent.name, agent.email)\n"
}
],
"parameters": [ "parameters": [
{ {
"$ref": "#/components/parameters/account_id" "$ref": "#/components/parameters/account_id"
@@ -5332,6 +5691,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Add agents to team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.teams.agents.add(\n account_id=1,\n team_id=5,\n agent_ids=[10, 11, 12]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5416,6 +5782,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Replace team agents",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\n# Replaces all current agents with the ones provided\nclient.teams.agents.add(\n account_id=1,\n team_id=5,\n agent_ids=[10, 11]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {
@@ -5500,6 +5873,13 @@
"userApiKey": [] "userApiKey": []
} }
], ],
"x-codeSamples": [
{
"lang": "python",
"label": "Remove agents from team",
"source": "from chatwoot import ChatwootClient\n\nclient = ChatwootClient(\n base_url=\"https://app.chatwoot.com\",\n api_token=\"your-api-token\"\n)\n\nclient.teams.agents.remove(\n account_id=1,\n team_id=5,\n agent_ids=[10]\n)\n"
}
],
"requestBody": { "requestBody": {
"required": true, "required": true,
"content": { "content": {