Chat messages

Chat messages refer to conversations between agents and customers in the application or tickets.

Resource representation

Property nameTypeDescription

id

int

The unique ID of the message.

ticket

int

The unique ID of a ticket where the message belongs.

userSendbirdId

string

The Sendbird ID of a customer or agent who sent the message. A value of event indicates that the message was sent from Desk platform.

userType

string

The sender of the message. Valid values are AGENT, CUSTOMER, and EVENT. EVENT signifies all messages expcept messages sent from users.

createdAt

datetime

The time and date when the message was sent, in ISO 8601 format.

message

string

The content of the message.

Actions

  • API endpoints in this page are relative to the base URL allocated to your application as below:
EndpointRefers to ...

/chat_messages

https://desk-api-{application_id}.sendbird.com/platform/v1/chat_messages

/tickets

https://desk-api-{application_id}.sendbird.com/platform/v1/tickets

Note: If you want to know your application ID, sign in to your dashboard, go to the Settings > Application > General, and then check the Application ID.

  • It's recommended that the parameter values in API URLs be urlencoded, such as {ticket_id}.
ActionHTTP request

List chat messages

GET /chat_messages
Retrieves a list of all chat messages in the application.

Retrieve a list of chat messages within a ticket

GET /tickets/{ticket_id}/chat_messages
Retrieves a list of chat messages within a specific ticket.


List chat messages

Retrieves a list of all chat messages in the application.

HTTP request

Light Color Skin
Copy
GET https://desk-api-{application_id}.sendbird.com/platform/v1/chat_messages 

Parameters

The following table lists the parameters that this action supports.

Parameters
OptionalTypeDescription

limit

int

Specifies the number of results to return per page. Acceptable values are 1 to 500, inclusive. (Default: 50)

offset

int

Specifies the number of results to skip before retrieving the next page in the result set. This is used to adjust the starting index of the next page. (Default: 0)

created_at__gte

string

Restricts the search scope to only retrieve chat messages sent after the specified time, in ISO 8601 format.

created_at__lte

string

Restricts the search scope to only retrieve chat messages with a specified channel type. Acceptable values are SENDBIRD, FACEBOOK_CONVERSATION, and FACEBOOK_FEED.

ticket__channel_type

string

Searches for chat messages with a specified channel type. Acceptable values are limited to SENDIBIRD, FACEBOOK_CONVERSATION, and FACEBOOK_FEED.

Query string example
Light Color Skin
Copy
?limit=50&offset=100

Response

If successful, this action returns a list of chat message resources in the response body.

Status: 200 OK
Light Color Skin
Copy
{
    "count": 20492,
    "previous": "https://desk-api-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx.sendbird.com/platform/v1/chat_messages?limit=50&offset=50",
    "next": "https://desk-api-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx.sendbird.com/platform/v1/chat_messages?limit=50&offset=150",
    "results": [
        {
            "id": 10933,
            "ticket": 3351,
            "userSendbirdId": "Jeff",
            "userType": "AGENT",
            "createdAt": "2019-03-12T05:25:41.032000Z",
            "message": "You'll get a 50% refund and the credit card request will be canceled in 3~5 business days."
        },
        ... # More chat messages 
    ]
}
Property nameTypeDescription

count

int

The total count of chat messages in the application.

previous

string

The URL to retrieve the previous page in the result set.

next

string

The URL to retrieve the next page in the result set.

results[]

list

A list of chat messages.


Retrieve a list of chat messages within a ticket

Retrieves a list of chat messages within a specific ticket.

HTTP request

Light Color Skin
Copy
GET https://desk-api-{application_id}.sendbird.com/platform/v1/tickets/{ticket_id}/chat_messages

Parameters

The following table lists the parameters that this action supports.

Parameters
RequiredTypeDescription

ticket_id

int

Specifies the unique ID of the target ticket.

OptionalTypeDescription

limit

int

Specifies the number of results to return per page. Acceptable values are 1 to 500, inclusive. (Default: 50)

offset

int

Specifies the number of results to skip before retrieving the next page in the result set. This is used to adjust the starting index of the next page. (Default: 0)

Query string example
Light Color Skin
Copy
?limit=10&offset=20

Response

If successful, this action returns a list of chat message resources in the response body.

Status: 200 OK
Light Color Skin
Copy
{
    "count": 43,
    "previous": "https://desk-api-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx.sendbird.com/platform/v1/tickets/325/chat_messages?limit=10&offset=10",
    "next": "https://desk-api-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx.sendbird.com/platform/v1/tickets/325/chat_messages?limit=10&offset=30",
    "results": [
        {
            "id": 38763,
            "ticket": 3351,
            "userSendbirdId": "event",
            "userType": "EVENT",
            "createdAt": "2020-05-11T14:25:54.189000Z",
            "message": "Welcome to Sendbird!"
        },
        ... # More chat messages 
    ]
}
Property nameTypeDescription

count

int

The total count of chat messages within the ticket.

previous

string

The URL to retrieve the previous page in the result set.

next

string

The URL to retrieve the next page in the result set.

results[]

list

A list of chat messages.