fc1fa579e9
* Added the documentation for the conversation APIs - 8 endpoints * Added descriptions for the existing endpoints * Added new resource models and updated some parts of the contact API
921 lines
No EOL
21 KiB
JSON
921 lines
No EOL
21 KiB
JSON
{
|
|
"swagger": 2.0,
|
|
"info": {
|
|
"description": "This is the api documentation for Chatwoot server.",
|
|
"version": "1.0.0",
|
|
"title": "Chatwoot",
|
|
"termsOfService": "https://www.chatwoot.com/terms-of-service/",
|
|
"contact": {
|
|
"email": "support@chatwoot.com"
|
|
},
|
|
"license": {
|
|
"name": "MIT License",
|
|
"url": "https://opensource.org/licenses/MIT"
|
|
},
|
|
"host": "app.chatwoot.com",
|
|
"basePath": "/api/v1/"
|
|
},
|
|
"paths": {
|
|
"/contacts": {
|
|
"get": {
|
|
"tags": [
|
|
"Contact"
|
|
],
|
|
"description": "Listing all the contacts with pagination",
|
|
"summary": "List Contacts",
|
|
"parameters": [
|
|
{
|
|
"name": "query_hash",
|
|
"in": "query",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/contact_list"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/bad_request_error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Contact"
|
|
],
|
|
"description": "Create New Contact",
|
|
"parameters": [
|
|
{
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/contact_create"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/extended_contact"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/bad_request_error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/contacts/{id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Contact"
|
|
],
|
|
"summary": "Show Contact",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the contact",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/extended_contact"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Contact not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Contact"
|
|
],
|
|
"summary": "Update Contact",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the contact",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/contact_update"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/contact_base"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Contact not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/contacts/{id}/conversations": {
|
|
"get": {
|
|
"tags": [
|
|
"Contact"
|
|
],
|
|
"summary": "Conversations",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the contact",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/contact_conversations"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Contact not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations": {
|
|
"get": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"description": "List all the conversations with pagination",
|
|
"summary": "Conversations List",
|
|
"parameters": [
|
|
{
|
|
"name": "query_hash",
|
|
"in": "query",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/conversation_list"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad Request Error",
|
|
"schema": {
|
|
"$ref": "#/definitions/bad_request_error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations/{id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"summary": "Conversation Details",
|
|
"description": "Get all details regarding a conversation with all messages in the conversation",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "ID of Conversation",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/conversation_show"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Conversation not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations/{id}/toggle_status": {
|
|
"post": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"summary": "Toggle Status",
|
|
"description": "Toggles the status of the conversation between open and resolved",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the conversation",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/conversation_status_toggle"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Conversation not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations/{id}/update_last_seen": {
|
|
"post": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations/{id}/labels": {
|
|
"get": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"summary": "List Labels",
|
|
"description": "Lists all the labels of a conversation",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the conversation",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/conversation_labels"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Conversation not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"summary": "Add Label",
|
|
"description": "Creates a new label and associates it with the conversation",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the conversation",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"labels": {
|
|
"type": "array",
|
|
"description": "array of labels",
|
|
"properties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/conversation_labels"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Conversation not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations/{id}/assignments": {
|
|
"post": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"summary": "Assign Conversation",
|
|
"description": "Assign a conversation to an agent",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the conversation",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"assignee_id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"$ref": "#/definitions/user"
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Conversation not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/conversations/{id}/messages": {
|
|
"post": {
|
|
"tags": [
|
|
"Conversation"
|
|
],
|
|
"summary": "Create New Message",
|
|
"description": "All the agent replies are created as new messages through this endpoint",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"type": "number",
|
|
"description": "id of the conversation",
|
|
"required": true
|
|
},
|
|
{
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/conversation_message_create"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": "Success",
|
|
"schema": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/generic_id"
|
|
},
|
|
{
|
|
"$ref": "#/definitions/message"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Conversation not found"
|
|
},
|
|
"403": {
|
|
"description": "Access denied"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"bad_request_error": {
|
|
"title": "data",
|
|
"type": "object",
|
|
"properties": {
|
|
"description": {
|
|
"type": "string"
|
|
},
|
|
"errors": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/request_error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"request_error": {
|
|
"type": "object",
|
|
"properties": {
|
|
"field": {
|
|
"type": "string"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"code": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"generic_id": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"contact": {
|
|
"type": "object",
|
|
"properties": {
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"phone_number": {
|
|
"type": "string"
|
|
},
|
|
"thumbnail": {
|
|
"type": "string"
|
|
},
|
|
"additional_attributes": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"conversation": {
|
|
"type": "object",
|
|
"properties": {
|
|
"messages": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object"
|
|
}
|
|
},
|
|
"inbox_id": {
|
|
"type": "number"
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"open",
|
|
"resolved"
|
|
]
|
|
},
|
|
"timestamp": {
|
|
"type": "string"
|
|
},
|
|
"user_last_seen_at": {
|
|
"type": "string"
|
|
},
|
|
"agent_last_seen_at": {
|
|
"type": "agent_last_seen_at"
|
|
},
|
|
"unread_count": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"message": {
|
|
"type": "object",
|
|
"properties": {
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"inbox_id": {
|
|
"type": "number"
|
|
},
|
|
"conversation_id": {
|
|
"type": "number"
|
|
},
|
|
"message_type": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "integer"
|
|
},
|
|
"private": {
|
|
"type": "boolean"
|
|
},
|
|
"attachment": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
},
|
|
"user": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "number"
|
|
},
|
|
"uid": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"account_id": {
|
|
"type": "number"
|
|
},
|
|
"role": {
|
|
"type": "string",
|
|
"enum": [
|
|
"agent",
|
|
"administrator"
|
|
]
|
|
},
|
|
"confirmed": {
|
|
"type": "boolean"
|
|
},
|
|
"nickname": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"extended_contact": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/contact"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "number"
|
|
},
|
|
"availability_status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"online",
|
|
"offline"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"contact_base": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/generic_id"
|
|
},
|
|
{
|
|
"$ref": "#/definitions/contact"
|
|
}
|
|
]
|
|
},
|
|
"contact_list": {
|
|
"type": "array",
|
|
"description": "array of contacts",
|
|
"items": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/generic_id"
|
|
},
|
|
{
|
|
"$ref": "#/definitions/contact"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"contact_conversations": {
|
|
"type": "array",
|
|
"description": "array of conversations",
|
|
"items": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/conversation"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"meta": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sender": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "number"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"thumbnail": {
|
|
"type": "string"
|
|
},
|
|
"channel": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"assignee": {
|
|
"$ref": "#/definitions/user"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"display_id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"conversation_list": {
|
|
"type": "object",
|
|
"properties": {
|
|
"data": {
|
|
"type": "object",
|
|
"properties": {
|
|
"meta": {
|
|
"type": "object",
|
|
"properties": {
|
|
"mine_count": {
|
|
"type": "number"
|
|
},
|
|
"unassigned_count": {
|
|
"type": "number"
|
|
},
|
|
"all_count": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"payload": {
|
|
"type": "array",
|
|
"description": "array of conversations",
|
|
"items": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/generic_id"
|
|
},
|
|
{
|
|
"$ref": "#/definitions/conversation"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"meta": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sender": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "number"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"thumbnail": {
|
|
"type": "string"
|
|
},
|
|
"channel": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"assignee": {
|
|
"$ref": "#/definitions/user"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"conversation_show": {
|
|
"type": "object",
|
|
"properties": {
|
|
"meta": {
|
|
"type": "object",
|
|
"properties": {
|
|
"labels": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additional_attributes": {
|
|
"type": "object"
|
|
},
|
|
"contact_id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"payload": {
|
|
"type": "array",
|
|
"description": "array of messages",
|
|
"items": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/extended_message"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"conversation_status_toggle": {
|
|
"type": "object",
|
|
"properties": {
|
|
"meta": {
|
|
"type": "object"
|
|
},
|
|
"payload": {
|
|
"type": "object",
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean"
|
|
},
|
|
"current_status": {
|
|
"type": "string",
|
|
"enum": [
|
|
"open",
|
|
"resolved"
|
|
]
|
|
},
|
|
"conversation_id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"conversation_labels": {
|
|
"type": "object",
|
|
"properties": {
|
|
"payload": {
|
|
"type": "array",
|
|
"description": "array of labels",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"extended_message": {
|
|
"allOf": [
|
|
{
|
|
"$ref": "#/definitions/generic_id"
|
|
},
|
|
{
|
|
"$ref": "#/definitions/message"
|
|
},
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"source_id": {
|
|
"type": "number"
|
|
},
|
|
"sender": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"contact_create": {
|
|
"type": "object",
|
|
"properties": {
|
|
"account_id": {
|
|
"type": "number"
|
|
},
|
|
"inbox_id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
},
|
|
"contact_update": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"phone_number": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"conversation_message_create": {
|
|
"type": "object",
|
|
"properties": {
|
|
"conversation_id": {
|
|
"type": "number"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"private": {
|
|
"type": "boolean"
|
|
},
|
|
"fb_id": {
|
|
"type": "number"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |