feat: Update swagger to openapi 3.0.4, update request payloads with examples (#11374)

This commit is contained in:
Daniel Jimenez
2025-05-22 19:26:44 +12:00
committed by GitHub
parent 8697a30dc5
commit 4b417ce9e7
189 changed files with 10098 additions and 5847 deletions

View File

@@ -1,30 +1,42 @@
tags:
- Conversation Assignment
- Conversations
operationId: assign-a-conversation
summary: Assign Conversation
description: Assign a conversation to an agent or a team
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
assignee_id:
type: number
description: Id of the assignee user
team_id:
type: number
description: Id of the team. If the assignee_id is present, this param would be ignored
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
assignee_id:
type: number
description: Id of the assignee user
example: 1
team_id:
type: number
description: Id of the team. If the assignee_id is present, this param would be ignored
example: 1
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/user'
404:
description: Conversation not found
401:
content:
application/json:
schema:
$ref: '#/components/schemas/user'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: Conversation not found
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -5,32 +5,41 @@ summary: Update Custom Attributes
description: Updates the custom attributes of a conversation
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
required:
- custom_attributes
properties:
custom_attributes:
type: object
description: The custom attributes to be set for the conversation
example:
order_id: "12345"
previous_conversation: "67890"
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- custom_attributes
properties:
custom_attributes:
type: object
description: The custom attributes to be set for the conversation
example:
order_id: '12345'
previous_conversation: '67890'
responses:
200:
'200':
description: Success
schema:
type: object
properties:
custom_attributes:
content:
application/json:
schema:
type: object
description: The custom attributes of the conversation
404:
properties:
custom_attributes:
type: object
description: The custom attributes of the conversation
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: Conversation not found
401:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -5,54 +5,59 @@ description: Filter conversations with custom filter options and pagination
summary: Conversations Filter
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: page
in: query
type: integer
- name: body
in: body
required: true
schema:
type: object
properties:
payload:
type: array
items:
type: object
properties:
attribute_key:
type: string
description: filter attribute name
filter_operator:
type: string
description: filter operator name
enum: [ equal_to, not_equal_to, contains, does_not_contain ]
values:
type: array
items:
type: number
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
payload:
type: array
items:
type: object
properties:
attribute_key:
type: string
description: array of the attribute values to filter
query_operator:
type: string
description: query operator name
enum: [ AND, OR ]
example:
- attribute_key: 'browser_language'
filter_operator: 'not_eq'
values: ['en']
query_operator: 'AND'
- attribute_key: 'status'
filter_operator: 'eq'
values: ['pending']
query_operator: null
description: filter attribute name
filter_operator:
type: string
description: filter operator name
enum: [equal_to, not_equal_to, contains, does_not_contain]
values:
type: array
items:
type: string
description: array of the attribute values to filter
query_operator:
type: string
description: query operator name
enum: [AND, OR]
example:
- attribute_key: 'browser_language'
filter_operator: 'not_equal_to'
values: ['en']
query_operator: 'AND'
- attribute_key: 'status'
filter_operator: 'equal_to'
values: ['pending']
query_operator: null
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_list'
'400':
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -1,5 +1,5 @@
parameters:
- $ref: '#/parameters/account_id'
- $ref: '#/components/parameters/account_id'
get:
tags:
@@ -7,138 +7,98 @@ get:
operationId: conversationList
description: List all the conversations with pagination
summary: Conversations List
security:
- userApiKey: []
parameters:
- name: assignee_type
in: query
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
default: 'all'
schema:
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
default: 'all'
description: Filter conversations by assignee type.
- name: status
in: query
type: string
enum: ['all', 'open', 'resolved', 'pending', 'snoozed']
default: 'open'
schema:
type: string
enum: ['all', 'open', 'resolved', 'pending', 'snoozed']
default: 'open'
description: Filter by conversation status.
- name: q
in: query
type: string
schema:
type: string
description: Filters conversations with messages containing the search term
- name: inbox_id
in: query
type: integer
schema:
type: integer
- name: team_id
in: query
type: integer
schema:
type: integer
- name: labels
in: query
type: array
items:
type: string
schema:
type: array
items:
type: string
- name: page
in: query
type: integer
default: 1
schema:
type: integer
default: 1
description: paginate through conversations
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_list'
'400':
description: Bad Request Error
schema:
$ref: '#/definitions/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://github.com/chatwoot/chatwoot/wiki/Building-on-Top-of-Chatwoot:-Importing-Existing-Contacts-and-Creating-Conversations"
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: []
parameters:
- name: data
in: body
required: true
schema:
type: object
required:
- source_id
- inbox_id
properties:
source_id:
type: string
description: Conversation source id
inbox_id:
type: string
description: "Id of inbox in which the conversation is created <br/> Allowed Inbox Types: Website, Phone, Api, Email "
contact_id:
type: string
description: Contact Id for which conversation is created
additional_attributes:
type: object
description: Lets you specify attributes like browser information
custom_attributes:
type: object
description: The object to save custom attributes for conversation, accepts custom attributes key and value
example: { attribute_key: attribute_value, priority_conversation_number: 3 }
status:
type: string
enum: ['open', 'resolved', 'pending']
description: Specify the conversation whether it's pending, open, closed
assignee_id:
type: string
description: Agent Id for assigning a conversation to an agent
team_id:
type: string
description: Team Id for assigning a conversation to a team
message:
type: object
description: The initial message to be sent to the conversation
required: ['content']
properties:
content:
type: string
description: The content of the message
template_params:
type: object
description: The template params for the message in case of whatsapp Channel
properties:
name:
type: string
description: Name of the template
example: 'sample_issue_resolution'
category:
type: string
description: Category of the template
example: UTILITY
language:
type: string
description: Language of the template
example: en_US
processed_params:
type: object
description: The processed param values for template variables in template
example:
1: "Chatwoot"
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_create_payload'
responses:
200:
'200':
description: Success
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:
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'

View File

@@ -1,26 +1,41 @@
tags:
- Conversation Labels
- Conversations
operationId: conversation-add-labels
summary: Add Labels
security:
- userApiKey: []
description: Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
labels:
type: array
description: Array of labels (comma-separated strings)
items:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- labels
properties:
labels:
type: array
description: Array of labels (comma-separated strings)
items:
type: string
example: ['support', 'billing']
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/conversation_labels'
404:
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_labels'
'404':
description: Conversation not found
401:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -1,14 +1,26 @@
tags:
- Conversation Labels
- Conversations
operationId: list-all-labels-of-a-conversation
summary: List Labels
security:
- userApiKey: []
description: Lists all the labels of a conversation
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/conversation_labels'
404:
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_labels'
'404':
description: Conversation not found
401:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -6,20 +6,30 @@ description: Create a new message in the conversation
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/conversation_message_create'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_message_create_payload'
responses:
200:
'200':
description: Success
schema:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/generic_id'
- $ref: '#/components/schemas/message'
'404':
description: Conversation not found
403:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'403':
description: Access denied
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -3,46 +3,55 @@ post:
- Messages
operationId: conversationNewMessageAttachment
summary: Create New Message Attachment
description: Create an attachment message. Refer to this discussion if you have any further doubts. https://github.com/chatwoot/chatwoot/discussions/1809#discussioncomment-1211845
consumes:
- multipart/form-data
description: Create an attachment message.
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- $ref: '#/parameters/account_id'
- $ref: '#/parameters/conversation_id'
required: true
- in: formData
name: content
type: string
description: The content of the message
required: true
- in: formData
name: message_type
type: string
enum: ['outgoing', 'incoming']
- in: formData
name: private
type: boolean
description: Flag to identify if it is a private note
- in: formData
name: attachments[]
type: array
description: The files to be uploaded.
items:
type: string
format: binary
- $ref: '#/components/parameters/account_id'
- $ref: '#/components/parameters/conversation_id'
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required:
- content
properties:
content:
type: string
description: The content of the message
message_type:
type: string
enum: ['outgoing', 'incoming']
private:
type: boolean
description: Flag to identify if it is a private note
attachments:
type: array
description: The files to be uploaded.
items:
type: string
format: binary
responses:
200:
'200':
description: Success
schema:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/generic_id'
- $ref: '#/components/schemas/message'
'404':
description: Conversation not found
403:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'403':
description: Access denied
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -2,11 +2,21 @@ tags:
- Messages
operationId: delete-a-message
summary: Delete a message
security:
- userApiKey: []
description: Delete a message and it's attachments from the conversation.
responses:
200:
'200':
description: Success
401:
'401':
description: Unauthorized
404:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: The message or conversation does not exist in the account
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -2,18 +2,30 @@ tags:
- Messages
operationId: list-all-messages
summary: Get messages
security:
- userApiKey: []
description: List all messages of a conversation
responses:
200:
'200':
description: Success
schema:
type: array
description: Array of messages
items:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
content:
application/json:
schema:
type: array
description: Array of messages
items:
allOf:
- $ref: '#/components/schemas/generic_id'
- $ref: '#/components/schemas/message'
'404':
description: Conversation not found
401:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -1,5 +1,5 @@
parameters:
- $ref: '#/parameters/account_id'
- $ref: '#/components/parameters/account_id'
get:
tags:
@@ -7,47 +7,58 @@ get:
operationId: conversationListMeta
description: Get open, unassigned and all Conversation counts
summary: Get Conversation Counts
security:
- userApiKey: []
parameters:
- name: status
in: query
type: string
enum: ['all', 'open', 'resolved', 'pending', 'snoozed']
default: 'open'
schema:
type: string
enum: ['all', 'open', 'resolved', 'pending', 'snoozed']
default: 'open'
description: Filter by conversation status.
- name: q
in: query
type: string
schema:
type: string
description: Filters conversations with messages containing the search term
- name: inbox_id
in: query
type: integer
schema:
type: integer
- name: team_id
in: query
type: integer
schema:
type: integer
- name: labels
in: query
type: array
items:
type: string
schema:
type: array
items:
type: string
responses:
200:
'200':
description: Success
schema:
type: object
properties:
meta:
content:
application/json:
schema:
type: object
properties:
mine_count:
type: number
unassigned_count:
type: number
assigned_count:
type: number
all_count:
type: number
400:
meta:
type: object
properties:
mine_count:
type: number
unassigned_count:
type: number
assigned_count:
type: number
all_count:
type: number
'400':
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -2,13 +2,25 @@ tags:
- Conversations
operationId: get-details-of-a-conversation
summary: Conversation Details
security:
- userApiKey: []
description: Get all details regarding a conversation with all messages in the conversation
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/conversation_show'
404:
description: Conversation not found
403:
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_show'
'403':
description: Access denied
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: Conversation not found
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -6,23 +6,32 @@ description: Toggles the priority of conversation
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
required:
- priority
properties:
priority:
type: string
enum: ["urgent", "high", "medium", "low", "none"]
description: "The priority of the conversation"
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- priority
properties:
priority:
type: string
enum: ['urgent', 'high', 'medium', 'low', 'none']
description: 'The priority of the conversation'
example: 'high'
responses:
200:
'200':
description: Success
404:
description: Conversation not found
401:
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: Conversation not found
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -6,25 +6,36 @@ description: Toggles the status of the conversation between open and resolved
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
required:
- status
properties:
status:
type: string
enum: ["open", "resolved", "pending"]
description: The status of the conversation
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
enum: ['open', 'resolved', 'pending']
description: The status of the conversation
example: open
responses:
200:
'200':
description: Success
schema:
$ref: '#/definitions/conversation_status_toggle'
404:
content:
application/json:
schema:
$ref: '#/components/schemas/conversation_status_toggle'
'404':
description: Conversation not found
401:
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -6,24 +6,34 @@ description: Update Conversation Attributes
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
priority:
type: string
enum: ["urgent", "high", "medium", "low", "none"]
description: "The priority of the conversation"
sla_policy_id:
type: number
description: "The ID of the SLA policy (Available only in Enterprise edition)"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
priority:
type: string
enum: ['urgent', 'high', 'medium', 'low', 'none']
description: 'The priority of the conversation'
example: 'high'
sla_policy_id:
type: number
description: 'The ID of the SLA policy (Available only in Enterprise edition)'
example: 1
responses:
200:
'200':
description: Success
404:
description: Conversation not found
401:
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: Conversation not found
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'

View File

@@ -3,6 +3,8 @@ post:
- Conversations
operationId: conversationUpdateLastSeen
summary: Update Last Seen
security:
- userApiKey: []
description: Updates the last seen of the conversation so that conversations will have the bubbles in the agents screen
parameters:
- name: id
@@ -11,9 +13,17 @@ post:
description: ID of the conversation
required: true
responses:
200:
'200':
description: Success
404:
description: Contact not found
403:
'403':
description: Access denied
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'
'404':
description: Contact not found
content:
application/json:
schema:
$ref: '#/components/schemas/bad_request_error'