feat: add sdk examples
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user