From 2b8ef7ce499b07f6227c6dd1ea26376b84480dba Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 19 Feb 2026 13:09:06 +0530 Subject: [PATCH] feat: more sdk methods --- swagger/paths/application/contacts/merge.yml | 19 +++++++++ .../application/inboxes/get_agent_bot.yml | 15 +++++++ .../inboxes/inbox_members/delete.yml | 16 ++++++++ .../inboxes/inbox_members/update.yml | 19 +++++++++ .../application/inboxes/set_agent_bot.yml | 23 +++++++++++ swagger/swagger.json | 40 +++++++++++++++++++ swagger/tag_groups/application_swagger.json | 40 +++++++++++++++++++ 7 files changed, 172 insertions(+) diff --git a/swagger/paths/application/contacts/merge.yml b/swagger/paths/application/contacts/merge.yml index 2c5057837..9fb98b66f 100644 --- a/swagger/paths/application/contacts/merge.yml +++ b/swagger/paths/application/contacts/merge.yml @@ -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: diff --git a/swagger/paths/application/inboxes/get_agent_bot.yml b/swagger/paths/application/inboxes/get_agent_bot.yml index f10d6b41f..9e80c948a 100644 --- a/swagger/paths/application/inboxes/get_agent_bot.yml +++ b/swagger/paths/application/inboxes/get_agent_bot.yml @@ -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 diff --git a/swagger/paths/application/inboxes/inbox_members/delete.yml b/swagger/paths/application/inboxes/inbox_members/delete.yml index a8df7661a..1f9895be4 100644 --- a/swagger/paths/application/inboxes/inbox_members/delete.yml +++ b/swagger/paths/application/inboxes/inbox_members/delete.yml @@ -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: diff --git a/swagger/paths/application/inboxes/inbox_members/update.yml b/swagger/paths/application/inboxes/inbox_members/update.yml index 728c2a028..3152f13b2 100644 --- a/swagger/paths/application/inboxes/inbox_members/update.yml +++ b/swagger/paths/application/inboxes/inbox_members/update.yml @@ -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: diff --git a/swagger/paths/application/inboxes/set_agent_bot.yml b/swagger/paths/application/inboxes/set_agent_bot.yml index bbd6a9e89..c2eec8d3f 100644 --- a/swagger/paths/application/inboxes/set_agent_bot.yml +++ b/swagger/paths/application/inboxes/set_agent_bot.yml @@ -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 diff --git a/swagger/swagger.json b/swagger/swagger.json index e88f7034b..72bb8d594 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -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": { diff --git a/swagger/tag_groups/application_swagger.json b/swagger/tag_groups/application_swagger.json index 0a638c436..a120754d2 100644 --- a/swagger/tag_groups/application_swagger.json +++ b/swagger/tag_groups/application_swagger.json @@ -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": {