feat: add sdk examples for team, inboxes and agents

This commit is contained in:
Shivam Mishra
2026-02-19 12:54:36 +05:30
parent 5e1109b13e
commit c74bb805f9
20 changed files with 539 additions and 0 deletions
@@ -5,6 +5,25 @@ summary: Add a New Agent
description: Add a new Agent to Account
security:
- 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:
required: true
content:
@@ -5,6 +5,18 @@ summary: Remove an Agent from Account
description: Remove an Agent from Account
security:
- 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:
- in: path
name: id
@@ -5,6 +5,21 @@ summary: List Agents in Account
description: Get Details of Agents in an Account
security:
- 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:
200:
description: Success
@@ -5,6 +5,25 @@ summary: Update Agent in Account
description: Update an Agent in Account
security:
- 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:
- in: path
name: id
@@ -8,6 +8,24 @@ post:
- userApiKey: []
parameters:
- $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:
required: true
content:
@@ -8,6 +8,21 @@ get:
- userApiKey: []
parameters:
- $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:
'200':
description: Success
@@ -14,6 +14,20 @@ get:
type: number
description: ID of the inbox
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:
'200':
description: Success
@@ -14,6 +14,25 @@ patch:
type: number
description: ID of the inbox
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:
required: true
content:
@@ -5,6 +5,22 @@ summary: Add a New Agent
description: Add a new Agent to Team
security:
- 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:
required: true
content:
@@ -5,6 +5,22 @@ summary: Remove an Agent from Team
description: Remove an Agent from Team
security:
- 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:
required: true
content:
@@ -5,6 +5,21 @@ summary: List Agents in Team
description: Get Details of Agents in an Team
security:
- 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:
- $ref: '#/components/parameters/account_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
security:
- 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
client.teams.agents.add(
account_id=1,
team_id=5,
agent_ids=[10, 11]
)
requestBody:
required: true
content:
@@ -7,6 +7,25 @@ security:
description: Create a team in the account
parameters:
- $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:
required: true
content:
@@ -5,6 +5,18 @@ summary: Delete a team
security:
- userApiKey: []
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:
'200':
description: Success
+15
View File
@@ -5,6 +5,21 @@ summary: List all teams
security:
- userApiKey: []
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:
'200':
description: Success
+14
View File
@@ -5,6 +5,20 @@ summary: Get a team details
security:
- userApiKey: []
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:
'200':
description: Success
@@ -5,6 +5,24 @@ summary: Update a team
security:
- userApiKey: []
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:
required: true
content: