diff --git a/swagger/definitions/index.yml b/swagger/definitions/index.yml index 8514a3957..eaa96c9b6 100644 --- a/swagger/definitions/index.yml +++ b/swagger/definitions/index.yml @@ -201,3 +201,12 @@ account_summary: $ref: './resource/reports/summary.yml' agent_conversation_metrics: $ref: './resource/reports/conversation/agent.yml' + +contact_detail: + $ref: ./resource/contact_detail.yml +message_detailed: + $ref: ./resource/message_detailed.yml +conversation_meta: + $ref: ./resource/conversation_meta.yml +conversation_messages: + $ref: ./resource/conversation_messages.yml diff --git a/swagger/definitions/resource/contact_detail.yml b/swagger/definitions/resource/contact_detail.yml new file mode 100644 index 000000000..060c91214 --- /dev/null +++ b/swagger/definitions/resource/contact_detail.yml @@ -0,0 +1,48 @@ +type: object +properties: + additional_attributes: + type: object + description: The object containing additional attributes related to the contact + properties: + city: + type: string + description: City of the contact + country: + type: string + description: Country of the contact + country_code: + type: string + description: Country code of the contact + created_at_ip: + type: string + description: IP address when the contact was created + custom_attributes: + type: object + description: The custom attributes of the contact + email: + type: string + description: The email address of the contact + id: + type: integer + description: The ID of the contact + identifier: + type: string + description: The identifier of the contact + nullable: true + name: + type: string + description: The name of the contact + phone_number: + type: string + description: The phone number of the contact + nullable: true + thumbnail: + type: string + description: The thumbnail of the contact + blocked: + type: boolean + description: Whether the contact is blocked + type: + type: string + description: The type of entity + enum: ["contact"] \ No newline at end of file diff --git a/swagger/definitions/resource/conversation_messages.yml b/swagger/definitions/resource/conversation_messages.yml new file mode 100644 index 000000000..904f2f2d4 --- /dev/null +++ b/swagger/definitions/resource/conversation_messages.yml @@ -0,0 +1,10 @@ +type: object +properties: + meta: + $ref: '#/components/schemas/conversation_meta' + description: Meta information about the conversation + payload: + type: array + items: + $ref: '#/components/schemas/message_detailed' + description: List of messages in the conversation \ No newline at end of file diff --git a/swagger/definitions/resource/conversation_meta.yml b/swagger/definitions/resource/conversation_meta.yml new file mode 100644 index 000000000..7cffc0fab --- /dev/null +++ b/swagger/definitions/resource/conversation_meta.yml @@ -0,0 +1,55 @@ +type: object +properties: + labels: + type: array + items: + type: string + description: Labels associated with the conversation + additional_attributes: + type: object + properties: + browser: + type: object + properties: + device_name: + type: string + description: Name of the device + browser_name: + type: string + description: Name of the browser + platform_name: + type: string + description: Name of the platform + browser_version: + type: string + description: Version of the browser + platform_version: + type: string + description: Version of the platform + referer: + type: string + description: Referrer URL + initiated_at: + type: object + properties: + timestamp: + type: string + description: Timestamp when the conversation was initiated + browser_language: + type: string + description: Browser language setting + conversation_language: + type: string + description: Conversation language + description: Additional attributes of the conversation + contact: + $ref: '#/components/schemas/contact_detail' + description: Contact details + agent_last_seen_at: + type: string + description: Timestamp when the agent last saw the conversation + nullable: true + assignee_last_seen_at: + type: string + description: Timestamp when the assignee last saw the conversation + nullable: true \ No newline at end of file diff --git a/swagger/definitions/resource/inbox.yml b/swagger/definitions/resource/inbox.yml index bba46ea34..88f5ea288 100644 --- a/swagger/definitions/resource/inbox.yml +++ b/swagger/definitions/resource/inbox.yml @@ -39,3 +39,87 @@ properties: greeting_message: type: string description: A greeting message when the user starts the conversation + channel_id: + type: number + description: ID of the channel this inbox belongs to + working_hours_enabled: + type: boolean + description: The flag which shows whether working hours feature is enabled + enable_email_collect: + type: boolean + description: The flag to enable collecting email from contacts + csat_survey_enabled: + type: boolean + description: The flag to enable CSAT survey + auto_assignment_config: + type: object + description: Configuration settings for auto assignment + out_of_office_message: + type: string + description: Message to show when agents are out of office + working_hours: + type: array + description: Configuration for working hours of the inbox + items: + type: object + properties: + day_of_week: + type: number + description: Day of the week (0-6, where 0 is Sunday) + closed_all_day: + type: boolean + description: Whether the inbox is closed for the entire day + open_hour: + type: number + description: Hour when inbox opens (0-23) + open_minutes: + type: number + description: Minutes of the hour when inbox opens (0-59) + close_hour: + type: number + description: Hour when inbox closes (0-23) + close_minutes: + type: number + description: Minutes of the hour when inbox closes (0-59) + open_all_day: + type: boolean + description: Whether the inbox is open for the entire day + timezone: + type: string + description: Timezone configuration for the inbox + callback_webhook_url: + type: string + description: Webhook URL for callbacks + allow_messages_after_resolved: + type: boolean + description: Whether to allow messages after a conversation is resolved + lock_to_single_conversation: + type: boolean + description: Whether to lock a contact to a single conversation + sender_name_type: + type: string + description: Type of sender name to display (e.g., friendly) + business_name: + type: string + description: Business name associated with the inbox + hmac_mandatory: + type: boolean + description: Whether HMAC verification is mandatory + selected_feature_flags: + type: object + description: Selected feature flags for the inbox + reply_time: + type: string + description: Expected reply time + messaging_service_sid: + type: string + description: Messaging service SID for SMS providers + phone_number: + type: string + description: Phone number associated with the inbox + medium: + type: string + description: Medium of communication (e.g., sms, email) + provider: + type: string + description: Provider of the channel diff --git a/swagger/definitions/resource/message.yml b/swagger/definitions/resource/message.yml index 0c4265ecb..f31936295 100644 --- a/swagger/definitions/resource/message.yml +++ b/swagger/definitions/resource/message.yml @@ -16,8 +16,8 @@ properties: type: number description: The ID of the conversation message_type: - type: string - enum: ["incoming", "outgoing", "activity", "template"] + type: integer + enum: [0, 1, 2] description: The type of the message created_at: type: integer diff --git a/swagger/definitions/resource/message_detailed.yml b/swagger/definitions/resource/message_detailed.yml new file mode 100644 index 000000000..49ff7aa09 --- /dev/null +++ b/swagger/definitions/resource/message_detailed.yml @@ -0,0 +1,47 @@ +type: object +properties: + id: + type: number + description: The ID of the message + content: + type: string + description: The text content of the message + inbox_id: + type: number + description: The ID of the inbox + conversation_id: + type: number + description: The ID of the conversation + message_type: + type: integer + enum: [0, 1, 2, 3] + description: "The type of the message (0: incoming, 1: outgoing, 2: activity, 3: template)" + content_type: + type: string + enum: ["text", "input_select", "cards", "form", "input_csat"] + description: The type of the message content + status: + type: string + enum: ["sent", "delivered", "read", "failed"] + description: The status of the message + content_attributes: + type: object + description: The content attributes for each content_type + properties: + in_reply_to: + type: string + description: ID of the message this is replying to + nullable: true + created_at: + type: integer + description: The timestamp when message was created + private: + type: boolean + description: The flag which shows whether the message is private or not + source_id: + type: string + description: The source ID of the message + nullable: true + sender: + $ref: '#/components/schemas/contact_detail' + description: The sender of the message (only for incoming messages) \ No newline at end of file diff --git a/swagger/paths/index.yml b/swagger/paths/index.yml index 1753d38b3..379b2eef0 100644 --- a/swagger/paths/index.yml +++ b/swagger/paths/index.yml @@ -600,3 +600,27 @@ description: The numeric ID of the user get: $ref: './application/reports/conversation/agent.yml' + +# Conversations Messages +/accounts/{account_id}/conversations/{conversation_id}/messages: + parameters: + - $ref: '#/components/parameters/account_id' + - name: conversation_id + in: path + description: ID of the conversation + required: true + schema: + type: number + get: + tags: + - Conversation + summary: Get messages from a conversation + description: Returns all messages from a specific conversation + operationId: getConversationMessages + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/conversation_messages' diff --git a/swagger/swagger.json b/swagger/swagger.json index c9be582ee..d7932a717 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -7441,6 +7441,42 @@ } } } + }, + "/accounts/{account_id}/conversations/{conversation_id}/messages": { + "parameters": [ + { + "$ref": "#/components/parameters/account_id" + }, + { + "name": "conversation_id", + "in": "path", + "description": "ID of the conversation", + "required": true, + "schema": { + "type": "number" + } + } + ], + "get": { + "tags": [ + "Conversation" + ], + "summary": "Get messages from a conversation", + "description": "Returns all messages from a specific conversation", + "operationId": "getConversationMessages", + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/conversation_messages" + } + } + } + } + } + } } }, "components": { @@ -7999,12 +8035,11 @@ "description": "The ID of the conversation" }, "message_type": { - "type": "string", + "type": "integer", "enum": [ - "incoming", - "outgoing", - "activity", - "template" + 0, + 1, + 2 ], "description": "The type of the message" }, @@ -8247,6 +8282,119 @@ "greeting_message": { "type": "string", "description": "A greeting message when the user starts the conversation" + }, + "channel_id": { + "type": "number", + "description": "ID of the channel this inbox belongs to" + }, + "working_hours_enabled": { + "type": "boolean", + "description": "The flag which shows whether working hours feature is enabled" + }, + "enable_email_collect": { + "type": "boolean", + "description": "The flag to enable collecting email from contacts" + }, + "csat_survey_enabled": { + "type": "boolean", + "description": "The flag to enable CSAT survey" + }, + "auto_assignment_config": { + "type": "object", + "description": "Configuration settings for auto assignment" + }, + "out_of_office_message": { + "type": "string", + "description": "Message to show when agents are out of office" + }, + "working_hours": { + "type": "array", + "description": "Configuration for working hours of the inbox", + "items": { + "type": "object", + "properties": { + "day_of_week": { + "type": "number", + "description": "Day of the week (0-6, where 0 is Sunday)" + }, + "closed_all_day": { + "type": "boolean", + "description": "Whether the inbox is closed for the entire day" + }, + "open_hour": { + "type": "number", + "description": "Hour when inbox opens (0-23)" + }, + "open_minutes": { + "type": "number", + "description": "Minutes of the hour when inbox opens (0-59)" + }, + "close_hour": { + "type": "number", + "description": "Hour when inbox closes (0-23)" + }, + "close_minutes": { + "type": "number", + "description": "Minutes of the hour when inbox closes (0-59)" + }, + "open_all_day": { + "type": "boolean", + "description": "Whether the inbox is open for the entire day" + } + } + } + }, + "timezone": { + "type": "string", + "description": "Timezone configuration for the inbox" + }, + "callback_webhook_url": { + "type": "string", + "description": "Webhook URL for callbacks" + }, + "allow_messages_after_resolved": { + "type": "boolean", + "description": "Whether to allow messages after a conversation is resolved" + }, + "lock_to_single_conversation": { + "type": "boolean", + "description": "Whether to lock a contact to a single conversation" + }, + "sender_name_type": { + "type": "string", + "description": "Type of sender name to display (e.g., friendly)" + }, + "business_name": { + "type": "string", + "description": "Business name associated with the inbox" + }, + "hmac_mandatory": { + "type": "boolean", + "description": "Whether HMAC verification is mandatory" + }, + "selected_feature_flags": { + "type": "object", + "description": "Selected feature flags for the inbox" + }, + "reply_time": { + "type": "string", + "description": "Expected reply time" + }, + "messaging_service_sid": { + "type": "string", + "description": "Messaging service SID for SMS providers" + }, + "phone_number": { + "type": "string", + "description": "Phone number associated with the inbox" + }, + "medium": { + "type": "string", + "description": "Medium of communication (e.g., sms, email)" + }, + "provider": { + "type": "string", + "description": "Provider of the channel" } } }, @@ -10472,6 +10620,245 @@ } } } + }, + "contact_detail": { + "type": "object", + "properties": { + "additional_attributes": { + "type": "object", + "description": "The object containing additional attributes related to the contact", + "properties": { + "city": { + "type": "string", + "description": "City of the contact" + }, + "country": { + "type": "string", + "description": "Country of the contact" + }, + "country_code": { + "type": "string", + "description": "Country code of the contact" + }, + "created_at_ip": { + "type": "string", + "description": "IP address when the contact was created" + } + } + }, + "custom_attributes": { + "type": "object", + "description": "The custom attributes of the contact" + }, + "email": { + "type": "string", + "description": "The email address of the contact" + }, + "id": { + "type": "integer", + "description": "The ID of the contact" + }, + "identifier": { + "type": "string", + "description": "The identifier of the contact", + "nullable": true + }, + "name": { + "type": "string", + "description": "The name of the contact" + }, + "phone_number": { + "type": "string", + "description": "The phone number of the contact", + "nullable": true + }, + "thumbnail": { + "type": "string", + "description": "The thumbnail of the contact" + }, + "blocked": { + "type": "boolean", + "description": "Whether the contact is blocked" + }, + "type": { + "type": "string", + "description": "The type of entity", + "enum": [ + "contact" + ] + } + } + }, + "message_detailed": { + "type": "object", + "properties": { + "id": { + "type": "number", + "description": "The ID of the message" + }, + "content": { + "type": "string", + "description": "The text content of the message" + }, + "inbox_id": { + "type": "number", + "description": "The ID of the inbox" + }, + "conversation_id": { + "type": "number", + "description": "The ID of the conversation" + }, + "message_type": { + "type": "integer", + "enum": [ + 0, + 1, + 2, + 3 + ], + "description": "The type of the message (0: incoming, 1: outgoing, 2: activity, 3: template)" + }, + "content_type": { + "type": "string", + "enum": [ + "text", + "input_select", + "cards", + "form", + "input_csat" + ], + "description": "The type of the message content" + }, + "status": { + "type": "string", + "enum": [ + "sent", + "delivered", + "read", + "failed" + ], + "description": "The status of the message" + }, + "content_attributes": { + "type": "object", + "description": "The content attributes for each content_type", + "properties": { + "in_reply_to": { + "type": "string", + "description": "ID of the message this is replying to", + "nullable": true + } + } + }, + "created_at": { + "type": "integer", + "description": "The timestamp when message was created" + }, + "private": { + "type": "boolean", + "description": "The flag which shows whether the message is private or not" + }, + "source_id": { + "type": "string", + "description": "The source ID of the message", + "nullable": true + }, + "sender": { + "$ref": "#/components/schemas/contact_detail" + } + } + }, + "conversation_meta": { + "type": "object", + "properties": { + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Labels associated with the conversation" + }, + "additional_attributes": { + "type": "object", + "properties": { + "browser": { + "type": "object", + "properties": { + "device_name": { + "type": "string", + "description": "Name of the device" + }, + "browser_name": { + "type": "string", + "description": "Name of the browser" + }, + "platform_name": { + "type": "string", + "description": "Name of the platform" + }, + "browser_version": { + "type": "string", + "description": "Version of the browser" + }, + "platform_version": { + "type": "string", + "description": "Version of the platform" + } + } + }, + "referer": { + "type": "string", + "description": "Referrer URL" + }, + "initiated_at": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "description": "Timestamp when the conversation was initiated" + } + } + }, + "browser_language": { + "type": "string", + "description": "Browser language setting" + }, + "conversation_language": { + "type": "string", + "description": "Conversation language" + } + }, + "description": "Additional attributes of the conversation" + }, + "contact": { + "$ref": "#/components/schemas/contact_detail" + }, + "agent_last_seen_at": { + "type": "string", + "description": "Timestamp when the agent last saw the conversation", + "nullable": true + }, + "assignee_last_seen_at": { + "type": "string", + "description": "Timestamp when the assignee last saw the conversation", + "nullable": true + } + } + }, + "conversation_messages": { + "type": "object", + "properties": { + "meta": { + "$ref": "#/components/schemas/conversation_meta" + }, + "payload": { + "type": "array", + "items": { + "$ref": "#/components/schemas/message_detailed" + }, + "description": "List of messages in the conversation" + } + } } }, "parameters": {