From c74bb805f96a24c0f53e0be45ef8dd57fa4cd7c3 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 19 Feb 2026 12:54:36 +0530 Subject: [PATCH] feat: add sdk examples for team, inboxes and agents --- swagger/paths/application/agents/create.yml | 19 +++ swagger/paths/application/agents/delete.yml | 12 ++ swagger/paths/application/agents/index.yml | 15 +++ swagger/paths/application/agents/update.yml | 19 +++ swagger/paths/application/inboxes/create.yml | 18 +++ swagger/paths/application/inboxes/index.yml | 15 +++ swagger/paths/application/inboxes/show.yml | 14 ++ swagger/paths/application/inboxes/update.yml | 19 +++ .../paths/application/team_members/create.yml | 16 +++ .../paths/application/team_members/delete.yml | 16 +++ .../paths/application/team_members/index.yml | 15 +++ .../paths/application/team_members/update.yml | 17 +++ swagger/paths/application/teams/create.yml | 19 +++ swagger/paths/application/teams/delete.yml | 12 ++ swagger/paths/application/teams/index.yml | 15 +++ swagger/paths/application/teams/show.yml | 14 ++ swagger/paths/application/teams/update.yml | 18 +++ swagger/paths/profile/index.yml | 14 ++ swagger/swagger.json | 126 ++++++++++++++++++ swagger/tag_groups/application_swagger.json | 126 ++++++++++++++++++ 20 files changed, 539 insertions(+) diff --git a/swagger/paths/application/agents/create.yml b/swagger/paths/application/agents/create.yml index 51436381e..107e09266 100644 --- a/swagger/paths/application/agents/create.yml +++ b/swagger/paths/application/agents/create.yml @@ -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: diff --git a/swagger/paths/application/agents/delete.yml b/swagger/paths/application/agents/delete.yml index d006659e3..cfaf3631f 100644 --- a/swagger/paths/application/agents/delete.yml +++ b/swagger/paths/application/agents/delete.yml @@ -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 diff --git a/swagger/paths/application/agents/index.yml b/swagger/paths/application/agents/index.yml index 2073e2ba0..8adbca826 100644 --- a/swagger/paths/application/agents/index.yml +++ b/swagger/paths/application/agents/index.yml @@ -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 diff --git a/swagger/paths/application/agents/update.yml b/swagger/paths/application/agents/update.yml index afb5579f3..4bf8fda9b 100644 --- a/swagger/paths/application/agents/update.yml +++ b/swagger/paths/application/agents/update.yml @@ -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 diff --git a/swagger/paths/application/inboxes/create.yml b/swagger/paths/application/inboxes/create.yml index 6f88b0d4a..ffbaf3469 100644 --- a/swagger/paths/application/inboxes/create.yml +++ b/swagger/paths/application/inboxes/create.yml @@ -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: diff --git a/swagger/paths/application/inboxes/index.yml b/swagger/paths/application/inboxes/index.yml index 89abb6009..94200d6b7 100644 --- a/swagger/paths/application/inboxes/index.yml +++ b/swagger/paths/application/inboxes/index.yml @@ -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 diff --git a/swagger/paths/application/inboxes/show.yml b/swagger/paths/application/inboxes/show.yml index 5d145c56e..82c8c292b 100644 --- a/swagger/paths/application/inboxes/show.yml +++ b/swagger/paths/application/inboxes/show.yml @@ -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 diff --git a/swagger/paths/application/inboxes/update.yml b/swagger/paths/application/inboxes/update.yml index e076dd532..8d7cc01bb 100644 --- a/swagger/paths/application/inboxes/update.yml +++ b/swagger/paths/application/inboxes/update.yml @@ -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: diff --git a/swagger/paths/application/team_members/create.yml b/swagger/paths/application/team_members/create.yml index bea148f73..2f30f5784 100644 --- a/swagger/paths/application/team_members/create.yml +++ b/swagger/paths/application/team_members/create.yml @@ -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: diff --git a/swagger/paths/application/team_members/delete.yml b/swagger/paths/application/team_members/delete.yml index 99deed83d..a0e2f7eba 100644 --- a/swagger/paths/application/team_members/delete.yml +++ b/swagger/paths/application/team_members/delete.yml @@ -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: diff --git a/swagger/paths/application/team_members/index.yml b/swagger/paths/application/team_members/index.yml index dfa505363..125918b2d 100644 --- a/swagger/paths/application/team_members/index.yml +++ b/swagger/paths/application/team_members/index.yml @@ -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' diff --git a/swagger/paths/application/team_members/update.yml b/swagger/paths/application/team_members/update.yml index 34a2de82f..20ee4518b 100644 --- a/swagger/paths/application/team_members/update.yml +++ b/swagger/paths/application/team_members/update.yml @@ -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: diff --git a/swagger/paths/application/teams/create.yml b/swagger/paths/application/teams/create.yml index b96068b11..2925220af 100644 --- a/swagger/paths/application/teams/create.yml +++ b/swagger/paths/application/teams/create.yml @@ -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: diff --git a/swagger/paths/application/teams/delete.yml b/swagger/paths/application/teams/delete.yml index eae30ecba..0b83913ef 100644 --- a/swagger/paths/application/teams/delete.yml +++ b/swagger/paths/application/teams/delete.yml @@ -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 diff --git a/swagger/paths/application/teams/index.yml b/swagger/paths/application/teams/index.yml index 85ac0ff8f..663cb6f72 100644 --- a/swagger/paths/application/teams/index.yml +++ b/swagger/paths/application/teams/index.yml @@ -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 diff --git a/swagger/paths/application/teams/show.yml b/swagger/paths/application/teams/show.yml index 15869beda..51d5cb4a9 100644 --- a/swagger/paths/application/teams/show.yml +++ b/swagger/paths/application/teams/show.yml @@ -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 diff --git a/swagger/paths/application/teams/update.yml b/swagger/paths/application/teams/update.yml index 5b620e888..360899b94 100644 --- a/swagger/paths/application/teams/update.yml +++ b/swagger/paths/application/teams/update.yml @@ -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: diff --git a/swagger/paths/profile/index.yml b/swagger/paths/profile/index.yml index 17eda92d0..87a979f5d 100644 --- a/swagger/paths/profile/index.yml +++ b/swagger/paths/profile/index.yml @@ -6,6 +6,20 @@ get: description: Get the user profile details security: - 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: '200': description: Success diff --git a/swagger/swagger.json b/swagger/swagger.json index 633af3741..63d6a596e 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -1943,6 +1943,13 @@ "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": { "200": { "description": "Success", @@ -1982,6 +1989,13 @@ "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": { "required": true, "content": { @@ -2034,6 +2048,13 @@ "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": [ { "in": "path", @@ -2100,6 +2121,13 @@ "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": [ { "in": "path", @@ -5472,6 +5500,13 @@ "$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": { "200": { "description": "Success", @@ -5542,6 +5577,13 @@ "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": { "200": { "description": "Success", @@ -5594,6 +5636,13 @@ "$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": { "required": true, "content": { @@ -5665,6 +5714,13 @@ "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": { "required": true, "content": { @@ -6646,6 +6702,13 @@ "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": { "200": { "description": "Success", @@ -6688,6 +6751,13 @@ } ], "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": { "200": { "description": "Success", @@ -6732,6 +6802,13 @@ "$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": { "required": true, "content": { @@ -6787,6 +6864,13 @@ } ], "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": { "200": { "description": "Success", @@ -6832,6 +6916,13 @@ } ], "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": { "required": true, "content": { @@ -6877,6 +6968,13 @@ } ], "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": { "200": { "description": "Success" @@ -6925,6 +7023,13 @@ "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": [ { "$ref": "#/components/parameters/account_id" @@ -6982,6 +7087,13 @@ "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": { "required": true, "content": { @@ -7066,6 +7178,13 @@ "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": { "required": true, "content": { @@ -7150,6 +7269,13 @@ "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": { "required": true, "content": { diff --git a/swagger/tag_groups/application_swagger.json b/swagger/tag_groups/application_swagger.json index 3e0f94454..925dea7cb 100644 --- a/swagger/tag_groups/application_swagger.json +++ b/swagger/tag_groups/application_swagger.json @@ -486,6 +486,13 @@ "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": { "200": { "description": "Success", @@ -525,6 +532,13 @@ "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": { "required": true, "content": { @@ -577,6 +591,13 @@ "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": [ { "in": "path", @@ -643,6 +664,13 @@ "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": [ { "in": "path", @@ -4015,6 +4043,13 @@ "$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": { "200": { "description": "Success", @@ -4085,6 +4120,13 @@ "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": { "200": { "description": "Success", @@ -4137,6 +4179,13 @@ "$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": { "required": true, "content": { @@ -4208,6 +4257,13 @@ "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": { "required": true, "content": { @@ -5189,6 +5245,13 @@ "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": { "200": { "description": "Success", @@ -5231,6 +5294,13 @@ } ], "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": { "200": { "description": "Success", @@ -5275,6 +5345,13 @@ "$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": { "required": true, "content": { @@ -5330,6 +5407,13 @@ } ], "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": { "200": { "description": "Success", @@ -5375,6 +5459,13 @@ } ], "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": { "required": true, "content": { @@ -5420,6 +5511,13 @@ } ], "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": { "200": { "description": "Success" @@ -5468,6 +5566,13 @@ "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": [ { "$ref": "#/components/parameters/account_id" @@ -5525,6 +5630,13 @@ "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": { "required": true, "content": { @@ -5609,6 +5721,13 @@ "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": { "required": true, "content": { @@ -5693,6 +5812,13 @@ "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": { "required": true, "content": {