From af8223545e9a24763de295e890539654ac2c7ce8 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 16 Jun 2021 00:14:09 +0530 Subject: [PATCH] chore: Swagger documentation for public APIs (#2417) --- swagger/definitions/index.yml | 98 ++- .../public/contact/create_update_payload.yml | 21 + .../request/public/message/create_payload.yml | 10 + .../request/public/message/update_payload.yml | 8 + .../definitions/resource/public/contact.yml | 17 + .../resource/public/conversation.yml | 14 + .../definitions/resource/public/message.yml | 36 + swagger/definitions/resource/user.yml | 2 - swagger/index.yml | 7 +- swagger/parameters/index.yml | 7 + .../parameters/public/contact_identifier.yml | 6 + .../parameters/public/inbox_identifier.yml | 6 + swagger/paths/index.yml | 49 ++ .../paths/public/inboxes/contacts/create.yml | 20 + .../paths/public/inboxes/contacts/show.yml | 16 + .../paths/public/inboxes/contacts/update.yml | 20 + .../public/inboxes/conversations/create.yml | 14 + .../public/inboxes/conversations/index.yml | 15 + .../paths/public/inboxes/messages/create.yml | 20 + .../paths/public/inboxes/messages/index.yml | 15 + .../paths/public/inboxes/messages/update.yml | 20 + swagger/swagger.json | 743 ++++++++++++++---- 22 files changed, 978 insertions(+), 186 deletions(-) create mode 100644 swagger/definitions/request/public/contact/create_update_payload.yml create mode 100644 swagger/definitions/request/public/message/create_payload.yml create mode 100644 swagger/definitions/request/public/message/update_payload.yml create mode 100644 swagger/definitions/resource/public/contact.yml create mode 100644 swagger/definitions/resource/public/conversation.yml create mode 100644 swagger/definitions/resource/public/message.yml create mode 100644 swagger/parameters/public/contact_identifier.yml create mode 100644 swagger/parameters/public/inbox_identifier.yml create mode 100644 swagger/paths/public/inboxes/contacts/create.yml create mode 100644 swagger/paths/public/inboxes/contacts/show.yml create mode 100644 swagger/paths/public/inboxes/contacts/update.yml create mode 100644 swagger/paths/public/inboxes/conversations/create.yml create mode 100644 swagger/paths/public/inboxes/conversations/index.yml create mode 100644 swagger/paths/public/inboxes/messages/create.yml create mode 100644 swagger/paths/public/inboxes/messages/index.yml create mode 100644 swagger/paths/public/inboxes/messages/update.yml diff --git a/swagger/definitions/index.yml b/swagger/definitions/index.yml index 14b71bb5b..56aeeef2b 100644 --- a/swagger/definitions/index.yml +++ b/swagger/definitions/index.yml @@ -1,10 +1,15 @@ -# ERROR +## ---------- ERRORS ------------- ## +## -------------------------------- ## bad_request_error: $ref: ./error/bad_request.yml request_error: $ref: ./error/request.yml -# RESOURCE + + +## ---------- RESOURCE ------------- ## +## -------------------------------- ## + generic_id: $ref: ./resource/extension/generic.yml contact: @@ -30,11 +35,63 @@ platform_account: team: $ref: ./resource/team.yml integrations_app: - $ref: ./resource/integrations/app.yml + $ref: ./resource/integrations/app.yml integrations_hook: - $ref: ./resource/integrations/hook.yml + $ref: ./resource/integrations/hook.yml -# RESPONSE +## public resources +public_contact: + $ref: ./resource/public/contact.yml +public_conversation: + $ref: ./resource/public/conversation.yml +public_message: + $ref: ./resource/public/message.yml + + +## ---------- REQUEST------------- ## +## -------------------------------- ## + +account_create_update_payload: + $ref: ./request/account/create_update_payload.yml + +agent_bot_create_update_payload: + $ref: ./request/agent_bot/create_update_payload.yml + +user_create_update_payload: + $ref: ./request/user/create_update_payload.yml + +## contact +contact_create: + $ref: ./request/contact/create.yml +contact_update: + $ref: ./request/contact/update.yml + +## conversation +conversation_message_create: + $ref: ./request/conversation/create_message.yml + +# Team request Payload +team_create_update_payload: + $ref: ./request/team/create_update_payload.yml + +integrations_hook_create_payload: + $ref: ./request/integrations/hook_create_payload.yml + +integrations_hook_update_payload: + $ref: ./request/integrations/hook_update_payload.yml + + +## public requests +public_contact_create_update_payload: + $ref: ./request/public/contact/create_update_payload.yml + +public_message_create_payload: + $ref: ./request/public/message/create_payload.yml +public_message_update_payload: + $ref: ./request/public/message/update_payload.yml + +## ---------- RESPONSE ------------- ## +## -------------------------------- ## ## contact extended_contact: @@ -77,34 +134,3 @@ extended_message: - $ref: '#/definitions/generic_id' - $ref: '#/definitions/message' - $ref: ./resource/extension/message/with_source_sender.yml - -# REQUEST - -account_create_update_payload: - $ref: ./request/account/create_update_payload.yml - -agent_bot_create_update_payload: - $ref: ./request/agent_bot/create_update_payload.yml - -user_create_update_payload: - $ref: ./request/account/create_update_payload.yml - -## contact -contact_create: - $ref: ./request/contact/create.yml -contact_update: - $ref: ./request/contact/update.yml -## conversation -conversation_message_create: - $ref: ./request/conversation/create_message.yml - -# Team request Payload - -team_create_update_payload: - $ref: ./request/team/create_update_payload.yml - -integrations_hook_create_payload: - $ref: ./request/integrations/hook_create_payload.yml - -integrations_hook_update_payload: - $ref: ./request/integrations/hook_update_payload.yml \ No newline at end of file diff --git a/swagger/definitions/request/public/contact/create_update_payload.yml b/swagger/definitions/request/public/contact/create_update_payload.yml new file mode 100644 index 000000000..9f1f820de --- /dev/null +++ b/swagger/definitions/request/public/contact/create_update_payload.yml @@ -0,0 +1,21 @@ + +type: object +properties: + identifier: + type: string + description: External identifier of the contact + identifier_hash: + type: string + description: Identifier hash prepared for HMAC authentication + email: + type: string + description: Email of the contact + name: + type: string + description: Name of the contact + avatar_url: + type: string + description: The url to a jpeg, png file for the user avatar + custom_attributes: + type: object + description: Custom attributes of the customer \ No newline at end of file diff --git a/swagger/definitions/request/public/message/create_payload.yml b/swagger/definitions/request/public/message/create_payload.yml new file mode 100644 index 000000000..2935b4abb --- /dev/null +++ b/swagger/definitions/request/public/message/create_payload.yml @@ -0,0 +1,10 @@ + +type: object +properties: + content: + type: string + description: Content for the message + echo_id: + type: string + description: Temporary identifier which will be passed back via websockets + \ No newline at end of file diff --git a/swagger/definitions/request/public/message/update_payload.yml b/swagger/definitions/request/public/message/update_payload.yml new file mode 100644 index 000000000..8e17ff840 --- /dev/null +++ b/swagger/definitions/request/public/message/update_payload.yml @@ -0,0 +1,8 @@ + +type: object +properties: + submitted_values: + type: object + description: Replies to the Bot Message Types + + \ No newline at end of file diff --git a/swagger/definitions/resource/public/contact.yml b/swagger/definitions/resource/public/contact.yml new file mode 100644 index 000000000..ae2eae8d3 --- /dev/null +++ b/swagger/definitions/resource/public/contact.yml @@ -0,0 +1,17 @@ +type: object +properties: + id: + type: integer + description: Id of the contact + source_id: + type: string + description: The session identifier of the contact + name: + type: string + description: Name of the contact + email: + type: string + description: Email of the contact + pubsub_token: + type: string + description: The token to be used to connect to chatwoot websocket \ No newline at end of file diff --git a/swagger/definitions/resource/public/conversation.yml b/swagger/definitions/resource/public/conversation.yml new file mode 100644 index 000000000..97e4b48eb --- /dev/null +++ b/swagger/definitions/resource/public/conversation.yml @@ -0,0 +1,14 @@ +type: object +properties: + id: + type: integer + description: Id of the conversation + inbox_id: + type: string + description: The inbox id of the conversation + messages: + type: array + description: Messages in the conversation + contact: + type: object + description: The contact information associated to the conversation \ No newline at end of file diff --git a/swagger/definitions/resource/public/message.yml b/swagger/definitions/resource/public/message.yml new file mode 100644 index 000000000..fe2c80a0c --- /dev/null +++ b/swagger/definitions/resource/public/message.yml @@ -0,0 +1,36 @@ +type: object +properties: + id: + type: string + description: Id of the message + content: + type: string + description: Text content of the message + message_type: + type: string + description: Denotes the message type + content_type: + type: string + description: Content type of the message + content_attributes: + type: string + description: Additional content attributes of the message + created_at: + type: string + description: Created at time stamp of the message + conversation_id: + type: string + description: Conversation Id of the message + attachments: + type: array + description: Attachments if any + sender: + type: object + description: Details of the sender + + + + + + + diff --git a/swagger/definitions/resource/user.yml b/swagger/definitions/resource/user.yml index cbffd7d68..04733b6b0 100644 --- a/swagger/definitions/resource/user.yml +++ b/swagger/definitions/resource/user.yml @@ -19,8 +19,6 @@ properties: enum: ['agent', 'administrator'] confirmed: type: boolean - display_name: - type: string accounts: type: array items: diff --git a/swagger/index.yml b/swagger/index.yml index 0719c0739..c0e36a5ec 100644 --- a/swagger/index.yml +++ b/swagger/index.yml @@ -61,4 +61,9 @@ x-tagGroups: - Messages - Integrations - Profile - - Teams \ No newline at end of file + - Teams + - name: Public + tags: + - Contacts API + - Conversations API + - Messages API \ No newline at end of file diff --git a/swagger/parameters/index.yml b/swagger/parameters/index.yml index 3e8f0cb68..3e123b868 100644 --- a/swagger/parameters/index.yml +++ b/swagger/parameters/index.yml @@ -27,3 +27,10 @@ page: platform_user_id: $ref: ./platform_user_id.yml + + +public_inbox_identifier: + $ref: ./public/inbox_identifier.yml + +public_contact_identifier: + $ref: ./public/contact_identifier.yml \ No newline at end of file diff --git a/swagger/parameters/public/contact_identifier.yml b/swagger/parameters/public/contact_identifier.yml new file mode 100644 index 000000000..3dd2d28c2 --- /dev/null +++ b/swagger/parameters/public/contact_identifier.yml @@ -0,0 +1,6 @@ +in: path +name: contact_identifier +schema: + type: string +required: true +description: The source id of contact obtained on contact create diff --git a/swagger/parameters/public/inbox_identifier.yml b/swagger/parameters/public/inbox_identifier.yml new file mode 100644 index 000000000..35e33e6c2 --- /dev/null +++ b/swagger/parameters/public/inbox_identifier.yml @@ -0,0 +1,6 @@ +in: path +name: inbox_identifier +schema: + type: string +required: true +description: The identifier obtained from API inbox channel diff --git a/swagger/paths/index.yml b/swagger/paths/index.yml index f4ece98a3..b358d307e 100644 --- a/swagger/paths/index.yml +++ b/swagger/paths/index.yml @@ -67,6 +67,55 @@ platform/api/v1/users/{id}/login: # ---------------- end of platform path -----------# +# ------------ Public API routes ------------# + +# Contacts + +public/api/v1/inboxes/{inbox_identifier}/contacts: + parameters: + - $ref: '#/parameters/public_inbox_identifier' + post: + $ref: ./public/inboxes/contacts/create.yml +public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}: + parameters: + - $ref: '#/parameters/public_inbox_identifier' + - $ref: '#/parameters/public_contact_identifier' + get: + $ref: './public/inboxes/contacts/show.yml' + patch: + $ref: ./public/inboxes/contacts/update.yml + + +public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations: + parameters: + - $ref: '#/parameters/public_inbox_identifier' + - $ref: '#/parameters/public_contact_identifier' + post: + $ref: ./public/inboxes/conversations/create.yml + get: + $ref: ./public/inboxes/conversations/index.yml + +public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages: + parameters: + - $ref: '#/parameters/public_inbox_identifier' + - $ref: '#/parameters/public_contact_identifier' + - $ref: '#/parameters/conversation_id' + post: + $ref: ./public/inboxes/messages/create.yml + get: + $ref: ./public/inboxes/messages/index.yml +public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages/{message_id}: + parameters: + - $ref: '#/parameters/public_inbox_identifier' + - $ref: '#/parameters/public_contact_identifier' + - $ref: '#/parameters/conversation_id' + - $ref: '#/parameters/message_id' + patch: + $ref: ./public/inboxes/messages/update.yml + +# ---------------- end of public api routes-----------# + +# ------------ Application API routes ------------# # AgentBots /api/v1/accounts/{account_id}/agent_bots: diff --git a/swagger/paths/public/inboxes/contacts/create.yml b/swagger/paths/public/inboxes/contacts/create.yml new file mode 100644 index 000000000..e504ee9e7 --- /dev/null +++ b/swagger/paths/public/inboxes/contacts/create.yml @@ -0,0 +1,20 @@ +tags: + - Contacts API +operationId: create-a-contact +summary: Create a contact +description: Create a contact +security: + - nil +parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/public_contact_create_update_payload' +responses: + 200: + description: Success + schema: + $ref: '#/definitions/public_contact' + 401: + description: Unauthorized diff --git a/swagger/paths/public/inboxes/contacts/show.yml b/swagger/paths/public/inboxes/contacts/show.yml new file mode 100644 index 000000000..a57d3e0b5 --- /dev/null +++ b/swagger/paths/public/inboxes/contacts/show.yml @@ -0,0 +1,16 @@ +tags: + - Contacts API +operationId: get-details-of-a-contact +summary: Get a contact +description: Get the details of a contact +security: + - nil +responses: + 200: + description: Success + schema: + $ref: '#/definitions/public_contact' + 401: + description: Unauthorized + 404: + description: The given contact does not exist diff --git a/swagger/paths/public/inboxes/contacts/update.yml b/swagger/paths/public/inboxes/contacts/update.yml new file mode 100644 index 000000000..084926134 --- /dev/null +++ b/swagger/paths/public/inboxes/contacts/update.yml @@ -0,0 +1,20 @@ +tags: + - Contacts API +operationId: update-a-contact +summary: Update a contact +description: Update a contact's attributes +security: + - nil +parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/public_contact_create_update_payload' +responses: + 200: + description: Success + schema: + $ref: '#/definitions/public_contact' + 401: + description: Unauthorized diff --git a/swagger/paths/public/inboxes/conversations/create.yml b/swagger/paths/public/inboxes/conversations/create.yml new file mode 100644 index 000000000..2654685f5 --- /dev/null +++ b/swagger/paths/public/inboxes/conversations/create.yml @@ -0,0 +1,14 @@ +tags: + - Conversations API +operationId: create-a-conversation +summary: Create a conversation +description: Create a conversation +security: + - nil +responses: + 200: + description: Success + schema: + $ref: '#/definitions/public_conversation' + 401: + description: Unauthorized diff --git a/swagger/paths/public/inboxes/conversations/index.yml b/swagger/paths/public/inboxes/conversations/index.yml new file mode 100644 index 000000000..bcd598758 --- /dev/null +++ b/swagger/paths/public/inboxes/conversations/index.yml @@ -0,0 +1,15 @@ +tags: + - Conversations API +operationId: list-all-contact-conversations +summary: List all conversations +description: List all conversations for the contact +responses: + 200: + description: Success + schema: + type: array + description: 'Array of conversations' + items: + $ref: '#/definitions/public_conversation' + 401: + description: Unauthorized diff --git a/swagger/paths/public/inboxes/messages/create.yml b/swagger/paths/public/inboxes/messages/create.yml new file mode 100644 index 000000000..16e44eb0d --- /dev/null +++ b/swagger/paths/public/inboxes/messages/create.yml @@ -0,0 +1,20 @@ +tags: + - Messages API +operationId: create-a-message +summary: Create a message +description: Create a message +security: + - nil +parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/public_message_create_payload' +responses: + 200: + description: Success + schema: + $ref: '#/definitions/public_message' + 401: + description: Unauthorized diff --git a/swagger/paths/public/inboxes/messages/index.yml b/swagger/paths/public/inboxes/messages/index.yml new file mode 100644 index 000000000..0c9eaeab3 --- /dev/null +++ b/swagger/paths/public/inboxes/messages/index.yml @@ -0,0 +1,15 @@ +tags: + - Messages API +operationId: list-all-converation-messages +summary: List all messages +description: List all messages in the conversation +responses: + 200: + description: Success + schema: + type: array + description: 'Array of messages' + items: + $ref: '#/definitions/public_message' + 401: + description: Unauthorized diff --git a/swagger/paths/public/inboxes/messages/update.yml b/swagger/paths/public/inboxes/messages/update.yml new file mode 100644 index 000000000..70ffb9d0c --- /dev/null +++ b/swagger/paths/public/inboxes/messages/update.yml @@ -0,0 +1,20 @@ +tags: + - Messages API +operationId: update-a-message +summary: Update a message +description: Update a message +security: + - nil +parameters: + - name: data + in: body + required: true + schema: + $ref: '#/definitions/public_message_update_payload' +responses: + 200: + description: Success + schema: + $ref: '#/definitions/public_message' + 401: + description: Unauthorized diff --git a/swagger/swagger.json b/swagger/swagger.json index bcb76ccf8..60ab58b48 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -682,6 +682,283 @@ } } }, + "public/api/v1/inboxes/{inbox_identifier}/contacts": { + "parameters": [ + { + "$ref": "#/parameters/public_inbox_identifier" + } + ], + "post": { + "tags": [ + "Contacts API" + ], + "operationId": "create-a-contact", + "summary": "Create a contact", + "description": "Create a contact", + "security": [ + "nil" + ], + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/public_contact_create_update_payload" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/public_contact" + } + }, + "401": { + "description": "Unauthorized" + } + } + } + }, + "public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}": { + "parameters": [ + { + "$ref": "#/parameters/public_inbox_identifier" + }, + { + "$ref": "#/parameters/public_contact_identifier" + } + ], + "get": { + "tags": [ + "Contacts API" + ], + "operationId": "get-details-of-a-contact", + "summary": "Get a contact", + "description": "Get the details of a contact", + "security": [ + "nil" + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/public_contact" + } + }, + "401": { + "description": "Unauthorized" + }, + "404": { + "description": "The given contact does not exist" + } + } + }, + "patch": { + "tags": [ + "Contacts API" + ], + "operationId": "update-a-contact", + "summary": "Update a contact", + "description": "Update a contact's attributes", + "security": [ + "nil" + ], + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/public_contact_create_update_payload" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/public_contact" + } + }, + "401": { + "description": "Unauthorized" + } + } + } + }, + "public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations": { + "parameters": [ + { + "$ref": "#/parameters/public_inbox_identifier" + }, + { + "$ref": "#/parameters/public_contact_identifier" + } + ], + "post": { + "tags": [ + "Conversations API" + ], + "operationId": "create-a-conversation", + "summary": "Create a conversation", + "description": "Create a conversation", + "security": [ + "nil" + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/public_conversation" + } + }, + "401": { + "description": "Unauthorized" + } + } + }, + "get": { + "tags": [ + "Conversations API" + ], + "operationId": "list-all-contact-conversations", + "summary": "List all conversations", + "description": "List all conversations for the contact", + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "description": "Array of conversations", + "items": { + "$ref": "#/definitions/public_conversation" + } + } + }, + "401": { + "description": "Unauthorized" + } + } + } + }, + "public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages": { + "parameters": [ + { + "$ref": "#/parameters/public_inbox_identifier" + }, + { + "$ref": "#/parameters/public_contact_identifier" + }, + { + "$ref": "#/parameters/conversation_id" + } + ], + "post": { + "tags": [ + "Messages API" + ], + "operationId": "create-a-message", + "summary": "Create a message", + "description": "Create a message", + "security": [ + "nil" + ], + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/public_message_create_payload" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/public_message" + } + }, + "401": { + "description": "Unauthorized" + } + } + }, + "get": { + "tags": [ + "Messages API" + ], + "operationId": "list-all-converation-messages", + "summary": "List all messages", + "description": "List all messages in the conversation", + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "description": "Array of messages", + "items": { + "$ref": "#/definitions/public_message" + } + } + }, + "401": { + "description": "Unauthorized" + } + } + } + }, + "public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages/{message_id}": { + "parameters": [ + { + "$ref": "#/parameters/public_inbox_identifier" + }, + { + "$ref": "#/parameters/public_contact_identifier" + }, + { + "$ref": "#/parameters/conversation_id" + }, + { + "$ref": "#/parameters/message_id" + } + ], + "patch": { + "tags": [ + "Messages API" + ], + "operationId": "update-a-message", + "summary": "Update a message", + "description": "Update a message", + "security": [ + "nil" + ], + "parameters": [ + { + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/public_message_update_payload" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/public_message" + } + }, + "401": { + "description": "Unauthorized" + } + } + } + }, "/api/v1/accounts/{account_id}/agent_bots": { "parameters": [ { @@ -2698,6 +2975,299 @@ } } }, + "public_contact": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Id of the contact" + }, + "source_id": { + "type": "string", + "description": "The session identifier of the contact" + }, + "name": { + "type": "string", + "description": "Name of the contact" + }, + "email": { + "type": "string", + "description": "Email of the contact" + }, + "pubsub_token": { + "type": "string", + "description": "The token to be used to connect to chatwoot websocket" + } + } + }, + "public_conversation": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "Id of the conversation" + }, + "inbox_id": { + "type": "string", + "description": "The inbox id of the conversation" + }, + "messages": { + "type": "array", + "description": "Messages in the conversation" + }, + "contact": { + "type": "object", + "description": "The contact information associated to the conversation" + } + } + }, + "public_message": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Id of the message" + }, + "content": { + "type": "string", + "description": "Text content of the message" + }, + "message_type": { + "type": "string", + "description": "Denotes the message type" + }, + "content_type": { + "type": "string", + "description": "Content type of the message" + }, + "content_attributes": { + "type": "string", + "description": "Additional content attributes of the message" + }, + "created_at": { + "type": "string", + "description": "Created at time stamp of the message" + }, + "conversation_id": { + "type": "string", + "description": "Conversation Id of the message" + }, + "attachments": { + "type": "array", + "description": "Attachments if any" + }, + "sender": { + "type": "object", + "description": "Details of the sender" + } + } + }, + "account_create_update_payload": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the account" + } + } + }, + "agent_bot_create_update_payload": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the agent bot" + }, + "description": { + "type": "string", + "description": "The description about the agent bot" + }, + "outgoing_url": { + "type": "string", + "description": "The webhook URL for the bot" + } + } + }, + "user_create_update_payload": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the user" + }, + "email": { + "type": "string", + "description": "Email of the user" + }, + "password": { + "type": "string", + "description": "Password must contain uppercase, lowercase letters, number and a special character" + } + } + }, + "contact_create": { + "type": "object", + "properties": { + "inbox_id": { + "type": "number", + "required": true + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone_number": { + "type": "string" + } + } + }, + "contact_update": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone_number": { + "type": "string" + } + } + }, + "conversation_message_create": { + "type": "object", + "properties": { + "content": { + "type": "string", + "description": "The content of the message", + "required": true + }, + "message_type": { + "type": "string", + "enum": [ + "outgoing", + "incoming" + ] + }, + "private": { + "type": "boolean", + "description": "Flag to identify if it is a private note" + }, + "content_type": { + "type": "string", + "enum": [ + "input_email", + "cards", + "input_select", + "form", + "article" + ], + "example": "cards", + "description": "if you want to create custom message types" + }, + "content_attributes": { + "type": "object", + "description": "attributes based on your content type" + } + } + }, + "team_create_update_payload": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The name of the team" + }, + "description": { + "type": "string", + "description": "The description of the team" + }, + "allow_auto_assign": { + "type": "boolean", + "description": "If this setting is turned on, the system would automatically assign the conversation to an agent in the team while assigning the conversation to a team" + } + } + }, + "integrations_hook_create_payload": { + "type": "object", + "properties": { + "app_id": { + "type": "string", + "description": "The ID of app for which integration hook is being created" + }, + "inbox_id": { + "type": "string", + "description": "The inbox ID, if the hook is an inbox hook" + }, + "settings": { + "type": "object", + "description": "The settings required by the integration" + } + } + }, + "integrations_hook_update_payload": { + "type": "object", + "properties": { + "settings": { + "type": "object", + "description": "The settings required by the integration" + } + } + }, + "public_contact_create_update_payload": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "description": "External identifier of the contact" + }, + "identifier_hash": { + "type": "string", + "description": "Identifier hash prepared for HMAC authentication" + }, + "email": { + "type": "string", + "description": "Email of the contact" + }, + "name": { + "type": "string", + "description": "Name of the contact" + }, + "avatar_url": { + "type": "string", + "description": "The url to a jpeg, png file for the user avatar" + }, + "custom_attributes": { + "type": "object", + "description": "Custom attributes of the customer" + } + } + }, + "public_message_create_payload": { + "type": "object", + "properties": { + "content": { + "type": "string", + "description": "Content for the message" + }, + "echo_id": { + "type": "string", + "description": "Temporary identifier which will be passed back via websockets" + } + } + }, + "public_message_update_payload": { + "type": "object", + "properties": { + "submitted_values": { + "type": "object", + "description": "Replies to the Bot Message Types" + } + } + }, "extended_contact": { "allOf": [ { @@ -2974,153 +3544,6 @@ } } ] - }, - "account_create_update_payload": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the account" - } - } - }, - "agent_bot_create_update_payload": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the agent bot" - }, - "description": { - "type": "string", - "description": "The description about the agent bot" - }, - "outgoing_url": { - "type": "string", - "description": "The webhook URL for the bot" - } - } - }, - "user_create_update_payload": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the account" - } - } - }, - "contact_create": { - "type": "object", - "properties": { - "inbox_id": { - "type": "number", - "required": true - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "phone_number": { - "type": "string" - } - } - }, - "contact_update": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "phone_number": { - "type": "string" - } - } - }, - "conversation_message_create": { - "type": "object", - "properties": { - "content": { - "type": "string", - "description": "The content of the message", - "required": true - }, - "message_type": { - "type": "string", - "enum": [ - "outgoing", - "incoming" - ] - }, - "private": { - "type": "boolean", - "description": "Flag to identify if it is a private note" - }, - "content_type": { - "type": "string", - "enum": [ - "input_email", - "cards", - "input_select", - "form", - "article" - ], - "example": "cards", - "description": "if you want to create custom message types" - }, - "content_attributes": { - "type": "object", - "description": "attributes based on your content type" - } - } - }, - "team_create_update_payload": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the team" - }, - "description": { - "type": "string", - "description": "The description of the team" - }, - "allow_auto_assign": { - "type": "boolean", - "description": "If this setting is turned on, the system would automatically assign the conversation to an agent in the team while assigning the conversation to a team" - } - } - }, - "integrations_hook_create_payload": { - "type": "object", - "properties": { - "app_id": { - "type": "string", - "description": "The ID of app for which integration hook is being created" - }, - "inbox_id": { - "type": "string", - "description": "The inbox ID, if the hook is an inbox hook" - }, - "settings": { - "type": "object", - "description": "The settings required by the integration" - } - } - }, - "integrations_hook_update_payload": { - "type": "object", - "properties": { - "settings": { - "type": "object", - "description": "The settings required by the integration" - } - } } }, "parameters": { @@ -3219,6 +3642,24 @@ }, "required": true, "description": "The numeric ID of the user on the platform" + }, + "public_inbox_identifier": { + "in": "path", + "name": "inbox_identifier", + "schema": { + "type": "string" + }, + "required": true, + "description": "The identifier obtained from API inbox channel" + }, + "public_contact_identifier": { + "in": "path", + "name": "contact_identifier", + "schema": { + "type": "string" + }, + "required": true, + "description": "The source id of contact obtained on contact create" } }, "x-tagGroups": [ @@ -3245,6 +3686,14 @@ "Profile", "Teams" ] + }, + { + "name": "Public", + "tags": [ + "Contacts API", + "Conversations API", + "Messages API" + ] } ] } \ No newline at end of file