chore: Move agent availability to Account level (#3074)

- Move agent availability to the account level
This commit is contained in:
Sojan Jose
2021-10-07 13:21:46 +05:30
committed by GitHub
parent 1c6a539c0a
commit c54aae21ff
84 changed files with 618 additions and 148 deletions

View File

@@ -0,0 +1,27 @@
tags:
- Conversation Assignment
operationId: assign-a-conversation
summary: Assign Conversation
description: Assign a conversation to an agent or a team
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
responses:
200:
description: Success
schema:
$ref: '#/definitions/user'
404:
description: Conversation not found
401:
description: Unauthorized

View File

@@ -0,0 +1,41 @@
get:
tags:
- Conversation
operationId: conversationList
description: List all the conversations with pagination
summary: Conversations List
parameters:
- $ref: '#/parameters/account_id'
- name: assignee_type
in: query
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
required: true
- name: status
in: query
type: string
enum: ['open', 'resolved', 'pending']
required: true
- name: page
in: query
type: integer
required: true
- name: inbox_id
in: query
type: integer
- name: labels
in: query
type: array
items:
type: string
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
description: Access denied

View File

@@ -0,0 +1,93 @@
get:
tags:
- Conversation
operationId: conversationSearch
description: Search for conversations containing a messages with the query string
summary: Conversations Search
parameters:
- name: q
in: query
type: string
- name: assignee_type
in: query
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
- name: status
in: query
type: string
enum: ['open', 'resolved', 'pending', 'all']
- name: page
in: query
type: integer
- name: inbox_id
in: query
type: integer
- name: labels
in: query
type: array
items:
type: string
- $ref: '#/parameters/account_id'
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
description: Access denied
post:
tags:
- Conversation
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"
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- $ref: '#/parameters/account_id'
- name: data
in: body
required: true
schema:
type: object
properties:
source_id:
$ref: '#/parameters/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
status:
type: string
enum: ['open', 'resolved', 'pending']
description: Specify the conversation whether it's pending, open, closed
responses:
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:
description: Access denied

View File

@@ -0,0 +1,26 @@
tags:
- Conversation Labels
operationId: conversation-add-labels
summary: Add Labels
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)
properties:
type: string
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_labels'
404:
description: Conversation not found
401:
description: Unauthorized

View File

@@ -0,0 +1,14 @@
tags:
- Conversation Labels
operationId: list-all-labels-of-a-conversation
summary: List Labels
description: Lists all the labels of a conversation
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_labels'
404:
description: Conversation not found
401:
description: Unauthorized

View File

@@ -0,0 +1,25 @@
tags:
- Messages
operationId: create-a-new-message-in-a-conversation
summary: Create New Message
description: Create a new message in the conversation
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/conversation_message_create'
responses:
200:
description: Success
schema:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
description: Conversation not found
403:
description: Access denied

View File

@@ -0,0 +1,47 @@
post:
tags:
- 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
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: file
responses:
200:
description: Success
schema:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
description: Conversation not found
403:
description: Access denied

View File

@@ -0,0 +1,12 @@
tags:
- Messages
operationId: delete-a-message
summary: Delete a message
description: Delete a message and it's attachments from the conversation.
responses:
200:
description: Success
401:
description: Unauthorized
404:
description: The message or conversation does not exist in the account

View File

@@ -0,0 +1,18 @@
tags:
- Messages
operationId: list-all-messages
summary: Get messages
description: List all messages of a conversation
responses:
200:
description: Success
type: array
description: Array of messages
schema:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
description: Conversation not found
401:
description: Unauthorized

View File

@@ -0,0 +1,14 @@
tags:
- Conversation
operationId: get-details-of-a-conversation
summary: Conversation Details
description: Get all details regarding a conversation with all messages in the conversation
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_show'
404:
description: Conversation not found
403:
description: Access denied

View File

@@ -0,0 +1,29 @@
tags:
- Conversation
operationId: toggle-status-of-a-conversation
summary: Toggle Status
description: Toggles the status of the conversation between open and resolved
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: data
in: body
required: true
schema:
type: object
properties:
status:
type: string
enum: ["open", "resolved", "pending"]
required: true
description: The status of the conversation
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_status_toggle'
404:
description: Conversation not found
401:
description: Unauthorized

View File

@@ -0,0 +1,19 @@
post:
tags:
- Conversation
operationId: conversationUpdateLastSeen
summary: Update Last Seen
description: Updates the last seen of the conversation so that conversations will have the bubbles in the agents screen
parameters:
- name: id
in: path
type: number
description: ID of the conversation
required: true
responses:
200:
description: Success
404:
description: Contact not found
403:
description: Access denied