Files

161 lines
4.1 KiB
YAML

parameters:
- $ref: '#/components/parameters/account_id'
get:
tags:
- Conversations
operationId: conversationList
description: List all the conversations with pagination
summary: Conversations List
security:
- userApiKey: []
parameters:
- name: assignee_type
in: query
schema:
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
default: 'all'
description: Filter conversations by assignee type.
- name: status
in: query
schema:
type: string
enum: ['all', 'open', 'resolved', 'pending', 'snoozed']
default: 'open'
description: Filter by conversation status.
- name: q
in: query
schema:
type: string
description: Filters conversations with messages containing the search term
- name: inbox_id
in: query
schema:
type: integer
- name: team_id
in: query
schema:
type: integer
- name: labels
in: query
schema:
type: array
items:
type: string
- name: page
in: query
schema:
type: integer
default: 1
description: paginate through conversations
x-codeSamples:
- lang: python
label: "List open conversations"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversations = client.conversations.list(
account_id=1,
status="open",
assignee_type="me",
page=1
)
for conversation in conversations:
print(conversation.id, conversation.status)
- lang: python
label: "Search conversations"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversations = client.conversations.list(
account_id=1,
q="billing issue",
inbox_id=5,
labels=["support"]
)
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_list'
'400':
description: Bad Request Error
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
post:
tags:
- Conversations
operationId: newConversation
summary: Create New Conversation
description: "Creating a conversation in chatwoot requires a source id. \n\n Learn more about source_id: https://www.chatwoot.com/hc/user-guide/articles/1677839703-how-to-create-an-api-channel-inbox#send-messages-to-the-api-channel"
security:
- userApiKey: []
- agentBotApiKey: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_create_payload'
x-codeSamples:
- lang: python
label: "Create a conversation"
source: |
from chatwoot import ChatwootClient
client = ChatwootClient(
base_url="https://app.chatwoot.com",
api_token="your-api-token"
)
conversation = client.conversations.create(
account_id=1,
source_id="user-123",
inbox_id=5,
contact_id=100
)
print(conversation.id, conversation.inbox_id)
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
id:
type: number
description: ID of the conversation
account_id:
type: number
description: Account Id
inbox_id:
type: number
description: ID of the inbox
'403':
description: Access denied
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'