feat: more sdk methods

This commit is contained in:
Shivam Mishra
2026-02-19 13:09:06 +05:30
parent 4449da1a1d
commit 2b8ef7ce49
7 changed files with 172 additions and 0 deletions
@@ -10,6 +10,25 @@ description: |
This action is irreversible. All conversations, labels, and custom attributes from the
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:
required: true
content:
@@ -6,6 +6,21 @@ get:
description: See if an agent bot is associated to the Inbox
security:
- 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:
- $ref: '#/components/parameters/account_id'
- name: id
@@ -5,6 +5,22 @@ summary: Remove an Agent from Inbox
description: Remove an Agent from Inbox
security:
- 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:
required: true
content:
@@ -5,6 +5,25 @@ summary: Update Agents in Inbox
description: All agents except the one passed in params will be removed
security:
- 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:
required: true
content:
@@ -6,6 +6,29 @@ post:
security:
- userApiKey: []
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:
- $ref: '#/components/parameters/account_id'
- name: id
+40
View File
@@ -3552,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",
"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": {
"required": true,
"content": {
@@ -5785,6 +5792,13 @@
"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": [
{
"$ref": "#/components/parameters/account_id"
@@ -5846,6 +5860,18 @@
}
],
"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": [
{
"$ref": "#/components/parameters/account_id"
@@ -6103,6 +6129,13 @@
"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": {
"required": true,
"content": {
@@ -6198,6 +6231,13 @@
"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": {
"required": true,
"content": {
@@ -2095,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",
"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": {
"required": true,
"content": {
@@ -4328,6 +4335,13 @@
"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": [
{
"$ref": "#/components/parameters/account_id"
@@ -4389,6 +4403,18 @@
}
],
"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": [
{
"$ref": "#/components/parameters/account_id"
@@ -4646,6 +4672,13 @@
"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": {
"required": true,
"content": {
@@ -4741,6 +4774,13 @@
"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": {
"required": true,
"content": {