logoDocument
Search

Send Message

Developers can send messages to specific conversations via the API.

Request Method

POST

Request URL

https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages

Authentication

See the authentication description in API Overview for details.

Text Request

Request Example

curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages' \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic base64(api_key:api_secret)' \ -d '{ "content": "Agent sending message, is it normal?", "private": false, "content_attributes": { "in_reply_to": 29 } }'
              
              curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
-d '{
    "content": "Agent sending message, is it normal?",  
    "private": false,
    "content_attributes": {
        "in_reply_to": 29   
    }
}'

            
This code block in the floating window

Request Headers

Field Type Description
Authorization string Use Authorization: Basic base64(API Key:API Secret) for authentication. Please go to the API Key page to get the API Key and API Secret, and connect them with a colon before Base64 encoding.
Content-Type application/json Data type, use application/json for plain text messages.

Path Parameters

Field Type Required Description
conversation_id string Yes Conversation ID.

Request Body Parameters

Field Type Required Description
content String Yes Message content.
private Boolean No Whether it is a private message, default is false.
content_attributes Object No Content attributes, such as specifying the message ID with in_reply_to field when replying to a message.

Text Response Example

Success Response

{ "id": 3030, "content": "Agent sending message, is it normal?", "inbox_id": 79, "conversation_id": 141, "message_type": 1, "content_type": "text", "status": "sent", "content_attributes": {}, "created_at": 1762331029, "private": false, "source_id": null, "sorting_id": 4, "sender": { "id": 3, "name": "TEST", "available_name": "TEST", "avatar_url": "", "type": "user", "availability_status": "offline", "thumbnail": "" } }
              
              {
    "id": 3030,
    "content": "Agent sending message, is it normal?",
    "inbox_id": 79,
    "conversation_id": 141,
    "message_type": 1,
    "content_type": "text",
    "status": "sent",
    "content_attributes": {},
    "created_at": 1762331029,
    "private": false,
    "source_id": null,
    "sorting_id": 4,
    "sender": {
        "id": 3,
        "name": "TEST",
        "available_name": "TEST",
        "avatar_url": "",
        "type": "user",
        "availability_status": "offline",
        "thumbnail": ""
    }
}

            
This code block in the floating window

Response Parameters

Field Type Description
id Int Message ID.
content String Message content.
inbox_id Int Inbox ID.
conversation_id Int Conversation ID.
message_type Int Message type.
content_type String Content type.
status String Message status, such as "sent", "delivered", etc.
content_attributes Object Content attributes.
created_at Int Message creation timestamp.
private Boolean Whether it is a private message.
source_id Int Source ID.
sorting_id Int Sorting ID.
sender Object Sender information.
id Int Sender ID.
name String Sender name.
available_name String Sender display name.
avatar_url String Sender avatar URL.
type String Sender type (e.g., user).
availability_status String Sender online status (e.g., offline).
thumbnail String Sender thumbnail.

Image/Audio/File Request

Request Example

curl -X POST "https://livedesk.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages" \ -H "Authorization: Basic base64(api_key:api_secret)" \ -F "attachments[]=@attachments[]=@/path/to/your/file.jpg" \ -F "content=Detailed image as follows"
              
              curl -X POST "https://livedesk.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages" \
  -H "Authorization: Basic base64(api_key:api_secret)" \
  -F "attachments[]=@attachments[]=@/path/to/your/file.jpg" \
  -F "content=Detailed image as follows" 

            
This code block in the floating window

Path Parameters

Field Type Required Description
conversation_id string Yes Conversation ID.

Image/Audio/File Response Example

Success Response

{ "id": 3031, "content": "Detailed image as follows", "inbox_id": 79, "conversation_id": 141, "message_type": 1, "content_type": "text", "status": "sent", "content_attributes": {}, "created_at": 1762331762, "private": false, "source_id": null, "sorting_id": 5, "sender": { "id": 3, "name": "Wenjie Yu", "available_name": "Wenjie Yu", "avatar_url": "", "type": "user", "availability_status": "offline", "thumbnail": "" }, "attachments": [ { "id": 199, "message_id": 3031, "file_type": "image", "account_id": 14, "extension": null, "data_url": "https://livedesk.engagelab.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/android-icon-48x48.png", "thumb_url": "https://livedesk.engagelab.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--63c890cbf173eb3dc92a8786fcc3e120c329852d/android-icon-48x48.png", "file_size": 589136, "width": null, "height": null } ] }
              
              {
    "id": 3031,
    "content": "Detailed image as follows",
    "inbox_id": 79,
    "conversation_id": 141,
    "message_type": 1,
    "content_type": "text",
    "status": "sent",
    "content_attributes": {},
    "created_at": 1762331762,
    "private": false,
    "source_id": null,
    "sorting_id": 5,
    "sender": {
        "id": 3,
        "name": "Wenjie Yu",
        "available_name": "Wenjie Yu",
        "avatar_url": "",
        "type": "user",
        "availability_status": "offline",
        "thumbnail": ""
    },
    "attachments": [
        {
            "id": 199,
            "message_id": 3031,
            "file_type": "image",
            "account_id": 14,
            "extension": null,
            "data_url": "https://livedesk.engagelab.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/android-icon-48x48.png",
            "thumb_url": "https://livedesk.engagelab.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--63c890cbf173eb3dc92a8786fcc3e120c329852d/android-icon-48x48.png",
            "file_size": 589136,
            "width": null,
            "height": null
        }
    ]
}

            
This code block in the floating window

Response Parameters

Field Type Description
id Int Message ID.
content String Message content.
inbox_id Int Inbox ID.
conversation_id Int Conversation ID.
message_type Int Message type.
content_type String Content type.
status String Message status, such as "sent", "delivered", etc.
content_attributes Object Content attributes.
created_at Int Message creation timestamp.
private Boolean Whether it is a private message.
source_id Int Source ID.
sorting_id Int Sorting ID.
sender Object Sender information.
id Int Sender ID.
name String Sender name.
available_name String Sender display name.
avatar_url String Sender avatar URL.
type String Sender type (e.g., user).
availability_status String Sender online status (e.g., offline).
thumbnail String Sender thumbnail.
attachments Array List of attachment information.
id Int Attachment ID.
message_id Int ID of the message it belongs to.
file_type String File type (e.g., image).
account_id Int Account ID.
extension String File extension.
data_url String File URL.
thumb_url String Thumbnail URL (image type only).
file_size Int File size (bytes).
width Int File width (image type only).
height Int File height (image type only).
icon
Contact Sales