diff --git a/swagger/paths/application/contactable_inboxes/get.yml b/swagger/paths/application/contactable_inboxes/get.yml index 8eea02bbf..39a1ad555 100644 --- a/swagger/paths/application/contactable_inboxes/get.yml +++ b/swagger/paths/application/contactable_inboxes/get.yml @@ -14,6 +14,24 @@ get: type: number description: ID of the contact 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: '200': description: Success diff --git a/swagger/paths/application/inboxes/inbox_members/create.yml b/swagger/paths/application/inboxes/inbox_members/create.yml index 47dcb8b2e..3a598398c 100644 --- a/swagger/paths/application/inboxes/inbox_members/create.yml +++ b/swagger/paths/application/inboxes/inbox_members/create.yml @@ -5,6 +5,24 @@ summary: Add a New Agent description: Add a new Agent to Inbox security: - 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: required: true content: diff --git a/swagger/paths/application/inboxes/inbox_members/show.yml b/swagger/paths/application/inboxes/inbox_members/show.yml index ec10a5f0b..c759566ec 100644 --- a/swagger/paths/application/inboxes/inbox_members/show.yml +++ b/swagger/paths/application/inboxes/inbox_members/show.yml @@ -5,6 +5,21 @@ summary: List Agents in Inbox description: Get Details of Agents in an Inbox security: - 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: - $ref: '#/components/parameters/inbox_id' responses: diff --git a/swagger/swagger.json b/swagger/swagger.json index 63d6a596e..e88f7034b 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -3493,6 +3493,13 @@ "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": { "200": { "description": "Success", @@ -5921,6 +5928,13 @@ "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": [ { "$ref": "#/components/parameters/inbox_id" @@ -5987,6 +6001,13 @@ "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": { "required": true, "content": { diff --git a/swagger/tag_groups/application_swagger.json b/swagger/tag_groups/application_swagger.json index 925dea7cb..0a638c436 100644 --- a/swagger/tag_groups/application_swagger.json +++ b/swagger/tag_groups/application_swagger.json @@ -2036,6 +2036,13 @@ "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": { "200": { "description": "Success", @@ -4464,6 +4471,13 @@ "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": [ { "$ref": "#/components/parameters/inbox_id" @@ -4530,6 +4544,13 @@ "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": { "required": true, "content": {