Home
/
Desk
/
Platform API
/
Ticket

Chat messages

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


Resource representation

The following table shows the list of properties in a chat messages resource.

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 except messages sent from users.

createdAt

string

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:

List of endpoints

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}.

List of actions

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

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

Parameters

The following table lists the parameters that this action supports.

Properties
RequiredTypeDescription

created_at__gte

string

Restricts the search scope to only retrieve chat messages whose createdAt is equal to or greater than the specified value, in ISO 8601 format.

created_at__lt

string

Restricts the search scope to only retrieve chat messages whose createdAt is less than the specified value, in ISO 8601 format.

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)

ticket_channel_type

string

Searches for chat messages with a specified channel type. Acceptable values are limited to SENDBIRD, SENDBIRD_IOS, SENDBIRD_ANDROID, SENDBIRD_JAVASCRIPT, FACEBOOK_CONVERSATION, FACEBOOK_FEED, TWITTER_STATUS, TWITTER_DIRECT_MESSAGE_EVENT, INSTAGRAM_COMMENT, and WHATSAPP_MESSAGE.

?created_at__gte=2021-10-13T10:00:00&created_at__lt=2021-10-13T10:00:00&limit=50&offset=100

Response

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

{
    "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
    ]
}

List of response properties

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

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)

?limit=10&offset=20

Response

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

{
    "count": 43,
    "previous": "https://desk-api-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx.sendbird.com/platform/v1/tickets/3351/chat_messages?limit=10&offset=10",
    "next": "https://desk-api-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx.sendbird.com/platform/v1/tickets/3351/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
    ]
}

List of response properties

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.