Web API Reference
Introduction
Versioning
This document describes the Customer Chat Web API v3.1. This is the legacy version. We encourage you to migrate to the latest stable version. Read more about versioning...
What is Web API
Web API is similar to REST API. Client can send a request message that results in getting a response message. It's also possible to get webhooks.
When to use Web API
If you're wondering which API to use - Customer Chat RTM API or Web API, keep on reading.
Web API allows for building stateless integrations. The communication is done via XHR requests. The implementation is easier than with RTM API, but you need to take possible time delays into consideration.
Not what you're looking for? Perhaps, you need to use Customer Chat RTM API instead.
Access
Customer authentication is handled by access tokens. Find out how to get an access token from Customer authorization flow. Take note it's not the same token you would you for the Agent Chat or Configuration API.
Data centers
LiveChat system operates in two data centers: dal
(USA) and fra
(Europe). The default data center is dal
.
All the LiveChat OAuth2.0 access tokens have a prefix: dal-
or fra-
. This prefix indicates the data center they belong to. If you need to specify the data center while making an API call, simply add the X-Region: <token_prefix>
optional header.
Summing up, if the user token starts with fra-
, you should add the X-Region: fra
header. If the token starts with, dal-
you don’t have to specify the header.
Postman Collection
You can find all the requests from the Customer Chat Web API v3.1 in Postman. In our collection, we use environment variables for the API version and the access token. Importing the collection from the link below downloads the LiveChat Web API environment as well. Remember to replace the sample token with your own.
Events
One of the data structures are events. They are sent to a chat via the send_event
method.
Apart from events, there are also Properties, Users, and Other common data structures.
These are the available event types:
File
The File event informs about a file being uploaded.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
custom_id | no | string | |
type | yes | string | file |
properties | no | object | Properties |
url | yes | string | Has to point to the LiveChat CDN. It's recommended to use the URL returned by upload_file . |
Response
Field | Returned | Notes |
---|---|---|
id | always | |
custom_id | optionally | |
created_at | always | Date & time format with a resolution of microseconds, UTC string . |
type | always | |
author_id | always | |
properties | optionally | |
name | always | |
url | always | |
thumbnail_url , thumbnail2x_url | only for images | |
content_type | always | |
size , width , height | only for images |
{
"id": "0affb00a-82d6-4e07-ae61-56ba5c36f743", // generated server-side
"custom_id": "31-0C-1C-07-DB-16",
"created_at": "2017-10-12T15:19:21.010200Z", // generated server-side
"type": "file",
"author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c", // generated server-side
"properties": {
// "Properties" object
},
"name": "image25.png", // generated server-side
"url": "https://example.com/image25.png",
"thumbnail_url": "https://example.com/thumbnail.png", // generated server-side
"thumbnail2x_url": "https://example.com/thumbnail2x.png", // generated server-side
"content_type": "image/png", // generated server-side
"size": 123444, // generated server-side
"width": 640, // generated server-side
"height": 480 // generated server-side
}
Filled form
The Filled form event contains data from a form (prechat or postchat survey).
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
custom_id | no | string | |
type | yes | string | filled_form |
properties | no | object | Properties |
form_id | yes | string | |
fields | yes | array | The fields a form contains. See filled form fields for details. |
Response
Field | Returned | Notes |
---|---|---|
id | always | |
custom_id | optionally | |
created_at | always | Date & time format with a resolution of microseconds, UTC string . |
type | always | |
author_id | always | |
properties | optionally | |
form_id | always | |
fields | always | An array of filled form fields |
{
"id": "0affb00a-82d6-4e07-ae61-56ba5c36f743", // generated server-side
"custom_id": "31-0C-1C-07-DB-16",
"created_at": "2017-10-12T15:19:21.010200Z", // generated server-side
"type": "filled_form",
"author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c", // generated server-side
"properties": {
// "Properties" object
},
"form_id": "1473433500211",
"fields": [{
"type": "name",
"id": "154417206262603539",
"label": "Your name",
"answer": "John Doe"
}, {
"type": "email",
"id": "154417206262601584",
"label": "Your email",
"answer": "customer1@example.com"
}, {
"type": "radio",
"id": "154417206262602571",
"label": "Chat purpose",
"answer": {
"id": "0",
"label": "Support"
}
}, {
"type": "checkbox",
"id": "154417206262604640",
"label": "Company industry",
"answers": [{
"id": "0"
"label": "automotive"
}, {
"id": "1"
"label": "it"
}]
}, {
"type": "group_chooser",
"id": "154417206262605324",
"label": "Choose department",
"answer": {
"group_id": 1,
"label": "Marketing"
}
}]
}
Message
Message event contains text message to other chat users.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
custom_id | no | string | |
text | yes | string | Max. raw text size is 16 KB (one UTF-8 char like emoji 😁 can use up to 4 B); to send more, split text into several messages. |
type | yes | string | message |
properties | no | object | Properties |
postback | no | object | Indicates that the message event was generated in response to a rich message event. |
postback.id | yes | string | ID of the postback from the rich message event. |
postback.thread_id | yes | string | ID of the thread with the rich message event. |
postback.event_id | yes | string | ID of the rich message event. |
postback.type | no | string | Should be used together with postback.value (when one of them is present, the other is required). |
postback.value | no | string | Should be used together with postback.type (when one of them is present, the other is required). |
Response
Field | Returned | Notes |
---|---|---|
id | always | |
custom_id | optionally | |
created_at | always | Date & time format with a resolution of microseconds, UTC string . |
type | always | message |
author_id | always | |
text | always | |
postback | optionally | Appears in a message only when triggered by a rich message. |
postback.id | always | |
postback.thread_id | always | |
postback.event_id | always | |
postback.type | optionally | Appears only if postback.value is present. |
postback.value | optionally | Appears only if postback.type is present. |
properties | optionally | Properties |
{
"id": "0affb00a-82d6-4e07-ae61-56ba5c36f743", // generated server-side
"custom_id": "31-0C-1C-07-DB-16",
"created_at": "2017-10-12T15:19:21.010200Z", // generated server-side
"type": "message",
"author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c", // generated server-side
"text": "hello there",
"postback": {
"id": "action_call",
"thread_id": "K600PKZON8",
"event_id": "75a90b82-e6a4-4ded-b3eb-cb531741ee0d",
"type": "phone",
"value": "790034890"
},
"properties": {
// "Properties" object
}
}
Rich message
Rich message (RM) event contains a rich message data structure. Read more about rich messages.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
custom_id | no | string | You can give your RM a custom ID. |
type | yes | string | Event type: rich_message |
properties | no | object | The properties data structure |
template_id | yes | string | Defines how every Rich Message will be presented. Values: cards , sticker , or quick_replies . |
elements | no | array | Can contain up to 10 element objects. |
elements.title | yes | string | Displays formatted text on RMs. |
elements.subtitle | yes | string | Displays formatted text on RMs. |
elements.image | yes | image | Displays images on RMs. Required param: url ; Optional params: name , content_type , size , width , height . |
elements.buttons | no | array | Displays buttons. Can contain up to 11 button objects. |
elements.buttons.text | yes | string | Text displayed on a button. |
elements.buttons.type | yes | string | Defines the behavior after a user clicks the button. Should be used together with elements.buttons.value . Possible values: webview , message , url , phone . More... |
elements.buttons.value | yes | string | Should be used together with elements.buttons.type . |
elements.buttons.webview_height | yes | string | Required only for the webview buttontype . Possible values: compact , full , tall . |
elements.buttons.postback_id | yes | string | A description of the sent action. Describes the action sent via send_rich_message_postback . More... |
elements.buttons.user_ids | yes | array | Describes users that sent the postback with "toggled": true . |
Response
Field | Returned | Notes |
---|---|---|
id | always | Generated server-side |
custom_id | optionally | |
type | always | |
author_id | always | Generated server-side |
created_at | always | Date & time format with a resolution of microseconds, UTC string . Generated server-side. |
properties | optionally | |
template_id | always | |
elements | optionally | |
elements.title | always | |
elements.subtitle | always | |
elements.image | always | |
elements.buttons | optionally | |
elements.buttons.text | always | |
elements.buttons.type | always | |
elements.buttons.value | always | |
elements.buttons.webview_height | always | Unless button type is different than webview . |
elements.buttons.postback_id | always | |
elements.buttons.user_ids | always |
{
"id": "0affb00a-82d6-4e07-ae61-56ba5c36f743",
"custom_id": "31-0C-1C-07-DB-16",
"type": "rich_message",
"author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
"created_at": "2017-10-12T15:19:21.010200Z",
"properties": {
// "Properties" object
},
"template_id": "cards",
"elements": [
{
"title": "Lorem ipsum dolor.",
"subtitle": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"image": {
"name": "image25.png",
"url": "https://example.com/image25.png",
"content_type": "image/png",
"size": 123444,
"width": 640,
"height": 480
},
"buttons": [
{
"text": "yes",
"postback_id": "action_yes",
"user_ids": ["b7eff798-f8df-4364-8059-649c35c9ed0c"]
},
{
"text": "no",
"postback_id": "action_no",
"user_ids": []
},
{
"type": "phone",
"text": "value",
"value": "790034890",
"webview_height": "tall",
"postback_id": "action_call",
"user_ids": []
}
]
}
]
}
Custom
Custom event is an event with customizable payload.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
custom_id | no | string | You can give the event a custom ID. |
type | yes | string | Event type: custom |
content | no | object | The content you define |
properties | no | object | The properties data structure |
Response
Field | Returned | Notes |
---|---|---|
id | always | Generated server-side |
custom_id | optionally | |
type | always | |
author_id | always | Generated server-side |
created_at | always | Date & time format with a resolution of microseconds, UTC string ; generated server-side |
content | optionally | |
properties | optionally |
{
"id": "0affb00a-82d6-4e07-ae61-56ba5c36f743",
"custom_id": "31-0C-1C-07-DB-16",
"type": "custom",
"author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
"created_at": "2017-10-12T15:19:21.010200Z",
"content": {
"custom": {
"nested": "json"
}
},
"properties": {
// "Properties" object
}
}
System message
System message event is a native system event sent in specific situations.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
custom_id | no | string | You can give the system message a custom ID. |
type | yes | string | system_message |
text | no | string | Text displayed to recipients |
system_message_type | yes | string | System message type |
text_vars | no | object | Variables used in the text |
Response
Field | Returned | Notes |
---|---|---|
id | always | Generated server-side |
custom_id | optionally | |
type | always | |
created_at | always | Date & time format with a resolution of microseconds, UTC string ; generated server-side |
text | optionally | |
system_message_type | always |
{
"id": "0affb00a-82d6-4e07-ae61-56ba5c36f743", // generated server-side
"custom_id": "31-0C-1C-07-DB-16",
"created_at": "2017-10-12T15:19:21.010200Z", // generated server-side
"type": "system_message",
"text": "hello there",
"system_message_type": "routing.assigned",
"text_vars": {
"agent": "John Doe"
}
}
Users
Users are another important data structure. Within this data structure type, we can distinguish:
Customer
{
"id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
"type": "customer",
"name": "John Smith",
"email": "customer1@example.com",
"avatar": "https://example.com/avatars/1.jpg",
"fields": {
"custom field name": "custom field value"
},
"present": true,
"events_seen_up_to": "2017-10-12T15:19:21.010200Z"
}
Field | Req./Opt. | |
---|---|---|
avatar | optional | |
email | optional | |
name | optional | |
fields | optional |
Agent
{
"id": "agent1@example.com",
"type": "agent",
"name": "Support Team",
"avatar": "cdn.livechatinc.com/avatars/1.png",
"present": true,
"events_seen_up_to": "2017-10-12T15:19:21.010200Z"
}
Other common structures
Apart from Events and Users, there are also other common data structures you might work with. Those are:
Access
{
"access": {
"group_ids": [1, 2]
}
}
Field | Req./Opt. | Note |
---|---|---|
group_ids | required | group 0 means that all agents can see it. |
Chats
{
"id": "PJ0MRSHTDG",
"users": [
// array of "User" objects
],
"threads": [
// optional
// "Thread" object
],
"threads_summary": [
{
"thread_id": "K600PKZON8",
"order": 129846129847
},
{
"thread_id": "K600PKZON8",
"order": 129846129848
}
],
"properites": {
// "Properites" object
},
"access": {
// "Access" object
},
"is_followed": true
}
Field | Req./Opt. | Note |
---|---|---|
properties | optional | |
access | optional |
Chat summaries
Chat summary is similar to the Chat data structure. The difference is that Chat contains a thread
object, while Chat summary includes last_thread_summary
and last_event_per_type
.
{
"id": "PJ0MRSHTDG",
"users": [
// array of "User" objects
],
"last_event_per_type": {
// last event of each type in chat
"message": {
"thread_id": "K600PKZON8",
"thread_order": 3,
"event": {
// "Event > Message" object
}
},
"system_message": {
"thread_id": "K600PKZON6",
"thread_order": 1,
"event": {
// "Event > System message" object
}
}
// ...
},
"last_thread_summary": {
"id": "K600PKZON8",
"order": 3,
"timestamp": 1473433500,
"user_ids": ["agent1@example.com"],
"properites": {
// "Properites" object
},
"tags": ["bug_report"]
},
"properites": {
// "Properites" object
},
"access": {
// "Access" object
},
"is_followed": false
}
Filled form fields
A component of the Filled form event.
Field | Required | Data type | Notes |
---|---|---|---|
fields | yes | array of objects | The fields a form contains. |
type | yes | string | Possible values: checkbox , email , name , question , textarea , group_chooser , radio , select |
id | yes | string | Field id, for all field types |
label | yes | string | Field label; for all field types |
answer | yes | any | For all field types |
answer.id | yes | string | Answer id; for all field types |
answer.label | yes | string | Answer label; for all field types |
answer.group_id | yes | number | For group_chooser |
{
"fields": [{
"type": "name",
"id": "154417206262603539",
"label": "Your name",
"answer": "John Doe"
}, {
"type": "email",
"id": "154417206262601584",
"label": "Your email",
"answer": "customer1@example.com"
}, {
"type": "radio",
"id": "154417206262602571",
"label": "Chat purpose",
"answer": {
"id": "0",
"label": "Support"
}
}, {
"type": "checkbox",
"id": "154417206262604640",
"label": "Company industry",
"answers": [{
"id": "0"
"label": "automotive"
}, {
"id": "1"
"label": "it"
}]
}, {
"type": "group_chooser",
"id": "154417206262605324",
"label": "Choose department",
"answer": {
"group_id": 1,
"label": "Marketing"
}
}]
}
Properties
Properties are key-value storages. They can be set within a chat, a thread, or an event. You can read more about properties in the Configuration API document.
{
"properties": {
"rating": {
// <property_namespace>
"score": {
// <property_name>
"value": 1 // <property_value>
},
"comment": {
"value": "rated good!"
}
},
"routing": {
"idle": {
"value": false
}
}
}
}
Threads
{
"id": "K600PKZON8",
"timestamp": 1473433500,
"active": true,
"user_ids": ["agent1@example.com"],
"events": [
// array of "Event" objects
],
"order": 112057129857,
"properties": {
// "Properties" object
},
"access": {
// "Access" object
}
}
Field | Req./Opt. | Note |
---|---|---|
access | optional | - |
active | required | Possible values: true (thread is still active) or false (thread no longer active). |
events | optional | - |
properties | optional | - |
Methods
Web API actions can generate webhooks, as well as pushes. However, pushes can be delivered only in the websocket transport. If you want to be notified about emitted events with webhooks, you need to register them first.
HTTP method | The API endpoint |
---|---|
POST | https://api.livechatinc.com/v3.1/customer/action/<action> |
Header | Value | Notes |
---|---|---|
Content-Type | multipart/form-data; boundary=<boundary> | Valid for the upload_file method |
Content-Type | application/json | Valid for every method except for upload_file |
Authorization | Bearer <token> | Customer access token. It's not the same token you would use for the Agent Chat or Configuration API. Read more... |
X-Region | fra | Required for a license from Europe. More info... |
X-API-Version | API version, for example 3.1 | You don't need this header if you specify API version in the URL. |
Every request to Customer Chat API needs to have the following query string parameters:
Required parameter | Data type | Notes |
---|---|---|
license_id | integer | LiveChat account ID |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action?license_id=<license_id> \
-H 'Content-Type: <content-type>' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
// payload
}'
Available methods
Chats
Get Chats Summary
It returns summaries of the chats a Customer participated in.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_chats_summary |
RTM API equivalent | get_chats_summary |
Webhook | - |
Request
Parameter | Required | Type | Notes |
---|---|---|---|
offset | No | number | Default: 0, maximum: 100 |
limit | No | number | Default: 10, maximum: 25 |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action/get_chats_summary?license_id=<license_id> \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{}'
{
"request_id": "<request_id>", // optional
"action": "get_chats_summary",
"type": "response",
"success": true,
"payload": {
"chats_summary": [
{
"id": "PJ0MRSHTDG",
"order": 1575892853242000,
"last_thread_id": "K600PKZON8",
"last_event_per_type": {
"message": {
"thread_id": "K600PKZON9",
"thread_order": 1,
"event": {
"id": "Q298LUVPRH_1",
"created_at": "2019-12-09T12:01:18.909000Z",
"type": "message",
"text": "hello world",
"author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c"
}
}
},
"users": [
{
"id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
"type": "customer",
"present": true
},
{
"id": "d5eff798-f8df-4364-8059-649c35c9ed0c",
"name": "Agent Name",
"type": "agent",
"present": true,
"avatar": "https://example.com/avatar.png",
"job_title": "Support Agent"
}
],
"access": {
"group_ids": [0]
},
"properties": {
// "Properties" object
}
},
"active": true
}
],
"total_chats": 1
}
}
Get Chat Threads Summary
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_chat_threads_summary |
RTM API equivalent | get_chat_threads_summary |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | |
offset | No | number | Default: 0 |
limit | No | number | Default: 25, maximum: 100 |
Response
Field | Notes | |
---|---|---|
threads_summary | Sorted descendingly by order . |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action/get_chat_threads_summary?license_id=<license_id> \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PJ0MRSHTDG"
}'
{
"threads_summary": [
{
"id": "Q298LUVPRH",
"order": 1,
"total_events": 1,
"active": true
}
],
"total_threads": 1
}
Get Chat Threads
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_chat_threads |
RTM API equivalent | get_chat_threads |
Webhook | - |
Request
Parameter | Required | Data type | |
---|---|---|---|
chat_id | Yes | string | |
thread_ids | Yes | array |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action/get_chat_threads?license_id=<license_id> \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PJ0MRSHTDG",
"thread_ids": ["K600PKZON8"]
}'
{
"chat": {
"id": "PJ0MRSHTDG",
"order": 1576569422,
"threads": [
{
"id": "K600PKZON8",
"active": true,
"user_ids": [
"b7eff798-f8df-4364-8059-649c35c9ed0c",
"bbb67d600796e9f277e360e842418833"
],
"events": [
{
"id": "Q20N9CKRX2_1",
"created_at": "2019-12-17T07:57:41.512000Z",
"type": "message",
"text": "Hello",
"author_id": "bbb67d600796e9f277e360e842418833"
}
],
"order": 1,
"properties": {
// "Property" object
},
"access": {
"group_ids": [0]
}
}
],
"users": [
{
"id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
"type": "customer",
"present": true
},
{
"id": "bbb67d600796e9f277e360e842418833",
"name": "Agent Name",
"type": "agent",
"present": true,
"avatar": "https://example.com/avatar.jpg",
"job_title": "Support Agent"
}
],
"access": {
"group_ids": [0]
},
"properties": {
// "Property" object
}
}
}
Start Chat
Starts a chat.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/start_chat |
RTM API equivalent | start_chat |
Webhook | incoming_chat_thread |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat | No | object | |
chat.properties | No | object | Initial chat properties |
chat.access | No | object | Chat access to set; default: all agents. |
chat.thread | No | object | |
chat.thread.events | No | array | Initial chat events array |
chat.thread.properties | No | object | Initial chat thread properties |
continuous | No | bool | Starts chat as continuous (online group is not required); default: false . |
Response
Field | Data type | Notes |
---|---|---|
chat_id | string | |
thread_id | string | |
event_ids | []string | Returned only when the chat was started with initial events. Returns only the IDs of user-generated events; server-side generated events are not included in the array. |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action/start_chat?license_id=<license_id> \
-H 'Content-Type: <content-type>' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{}'
{
"chat_id": "PJ0MRSHTDG",
"thread_id": "PGDGHT5G"
}
Activate Chat
Used to restart an archived chat.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/activate_chat |
RTM API equivalent | activate_chat |
Webhook | incoming_chat_thread |
Request
Parameter | Required | Type | Notes |
---|---|---|---|
chat | Yes | object | |
chat.id | Yes | string | ID of the chat that will be activated. |
chat.access | No | object | Chat access to set; default: all agents. |
chat.properties | No | object | Initial chat properties |
chat.thread | No | object | |
chat.thread.events | No | array | Initial chat events array |
chat.thread.properties | No | object | Initial chat thread properties |
continuous | No | bool | Sets a chat to the continuous mode. When unset, leaves the mode unchanged. |
Response
Field | Data type | Notes |
---|---|---|
thread_id | string | |
event_ids | []string | Returned only when the chat was activated with initial events. Returns only the IDs of user-generated events; server-side generated events are not included in the array. |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action/activate_chat?license_id=<license_id> \
-H 'Content-Type: <content-type>' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat": {
"id": "PWLW03ICW7"
}
}'
{
"thread_id": "Z8AGR5OUW"
}
Close Thread
Closes the thread. Sending messages to this thread will no longer be possible.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/close_thread |
RTM API equivalent | close_thread |
Webhook | incoming_event and thread_closed |
Request
Parameter | Required | Data type | |
---|---|---|---|
chat_id | Yes | string |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/close_thread?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PWLW03ICW7"
}'
Events
Send Event
Sends an Event object. Use this method to send a message by specifing the Message event type in the request.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/send_event |
RTM API equivalent | send_event |
Webhook | incoming_event |
Request
Parameters | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat that you to send a message to. |
event | Yes | object | The event object |
attach_to_last_thread | No | bool | The flag is ignored for active chats. For inactive chats: true – the event will be added to the last thread; false – the request will fail. Default: false . |
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/send_event?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-d '{
"chat_id": "PWLW03ICW7",
"event": {
"type": "message",
"text": "hello world",
"recipients": "all"
}
}'
{
"event_id": "K600PKZON8"
}
Upload File
Uploads a file to the server as a temporary file. It returns a URL that expires after 24 hours unless the URL is used in send_event
.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/upload_file |
RTM API equivalent | - |
Webhook | incoming_event * |
*)
incoming_event
returns a URL that never expires.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
file | Yes | binary | Maximum size: 10MB |
REQUEST
curl -X POST \
https://api.livechatinc.com/v3.1/customer/action/upload_file?license_id=<license_id> \
-H 'Authorization: Bearer <customer_access_token>' \
-H 'Content-Type: multipart/form-data; boundary=--------------------------210197025774705439685896' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F file=@/Users/MyAccount/Desktop/image.png
{
"url": "https://cdn.livechat-files.com/api/file/lc/att/8948324/45a3581b59a7295145c3825c86ec7ab3/image.png"
}
Send Rich Message Postback
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/send_rich_message_postback |
RTM API equivalent | send_rich_message_postback |
Webhook | incoming_rich_message_postback * |
*) incoming_rich_message_postback
will be sent only for active threads.
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | |
event_id | Yes | string | |
postback | Yes | object | |
postback.id | Yes | string | Postback name of the button |
postback.toggled | Yes | bool | Postback toggled; true or false |
thread_id | Yes | string |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/send_rich_message_postback?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PJ0MRSHTDG",
"thread_id": "K600PKZON8",
"event_id": "a0c22fdd-fb71-40b5-bfc6-a8a0bc3117f7",
"postback": {
"id": "Method URL_yes",
"toggled": true
}
}'
Send Sneak Peek
Sends a sneak peek to a chat.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/send_sneak_peek |
RTM API equivalent | send_sneak_peek |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat to send a sneak peek to. |
sneak_peek_text | Yes | string | Sneak peek text |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/send_sneak_peek?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PJ0MRSHTDG",
"sneak_peek_text": "hello world"
}'
Properties
Update Chat Properties
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/update_chat_properties |
RTM API equivalent | update_chat_properties |
Webhook | chat_properties_updated |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat you to set a property for. |
properties | Yes | object | Chat properties to set. You should stick to the general properties format and include namespace, property name and value. |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/update_chat_properties?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PW94SJTGW6",
"properties": {
"bb9e5b2f1ab480e4a715977b7b1b4279": {
"score": 10,
"comment": "Thank you!"
}
}
}'
Delete Chat Properties
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/delete_chat_properties |
RTM API equivalent | delete_chat_properties |
Webhook | chat_properties_deleted |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat you want to delete properties of. |
properties | Yes | object | Chat properties to delete. |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/delete_chat_properties?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PW94SJTGW6",
"properties": {
"bb9e5b2f1ab480e4a715977b7b1b4279": [
"score",
"comment"
]
}
}'
Update Chat Thread Properties
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/update_chat_thread_properties |
RTM API equivalent | update_chat_thread_properties |
Webhook | chat_thread_properties_updated |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat you want to set properties for. |
thread_id | Yes | string | Id of the thread you want to set properties for. |
properties | Yes | object | Chat properties to set. |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/update_chat_thread_properties?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PW94SJTGW6",
"thread_id": "K600PKZON8",
"properties": {
"bb9e5b2f1ab480e4a715977b7b1b4279": {
"score": 10,
"comment": "Thank you!"
}
}
}'
Delete Chat Thread Properties
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/delete_chat_thread_properties |
RTM API equivalent | delete_chat_thread_properties |
Webhook | chat_thread_properties_deleted |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat you want to delete the properties of. |
thread_id | Yes | string | Id of the thread you want to delete the properties of. |
properties | Yes | object | Chat thread properties to delete. |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/delete_chat_thread_properties?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PW94SJTGW6",
"thread_id": "K600PKZON8",
"properties": {
"bb9e5b2f1ab480e4a715977b7b1b4279": [
"score",
"comment"
]
}
}'
Update Event Properties
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/update_event_properties |
RTM API equivalent | update_event_properties |
Webhook | event_properties_updated |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat you want to set properties for. |
thread_id | Yes | string | Id of the thread you want to set properties for. |
event_id | Yes | string | Id of the event you want to set properties for. |
properties | Yes | object | Chat properties to set. You should stick to the general properties format and include namespace, property name and value. |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/update_event_properties?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PW94SJTGW6",
"thread_id": "K600PKZON8",
"event_id": "2_EW2WQSA8",
"properties": {
"bb9e5b2f1ab480e4a715977b7b1b4279": {
"score": 10,
"comment": "Thank you!"
}
}
}'
Delete Event Properties
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/delete_event_properties |
RTM API equivalent | delete_event_properties |
Webhook | event_properties_deleted |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | Id of the chat you want to delete the properties of. |
thread_id | Yes | string | Id of the thread you want to delete the properties of. |
event_id | Yes | string | Id of the event you want to delete the properties of. |
properties | Yes | object | Event properties to delete. You should stick to the general properties format and include namespace, property name and value. |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/delete_event_properties?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PWLW03ICW7",
"thread_id": "PWNWW5N6A8",
"event_id": "PWNWW5N6A8_1",
"properties": {
"rating": [
"score",
"comment"
]
}
}'
Customers
Update Customer
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/update_customer |
RTM API equivalent | update_customer |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
name | No | string | |
email | No | string | |
avatar | No | string | The URL of the Customer's avatar |
fields | No | object | key: value format |
At least one optional parameter needs to be included in the request.
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/update_customer?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"name": "John Doe"
}'
Set Customer Fields
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/set_customer_fields |
RTM API equivalent | set_customer_fields |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
fields | Yes | object | key:value format |
Users Agent and referrer are updated by default using the browser’s headers.
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/set_customer_fields?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"fields": {
"company_size": "10-100"
}
}'
Status
Get Groups Status
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_groups_status |
RTM API equivalent | get_groups_status |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
all | No | bool | If set to true , you will get statuses of all the groups. |
groups | No | array | A table of groups' IDs |
One of the optional parameters needs to be included in the request.
Response
No response payload (200 OK
).
Response
Group Not Found | If you send group_id of a group that doesn't exists, the id won't be included in the resposne. |
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/get_groups_status?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"all": true
}'
{
"groups_status": {
//1,2,3 are group ids, online/offline/online_for_queue are statuses of the groups
1: "online",
2: "offline",
3: "online_for_queue"
}
}
Other
Check Goals
Customer can use this method to trigger checking if goals were achieved. Then, Agents receive the information. You should call this method to provide goals parameters for the server when the customers limit is reached. Works only for offline Customers.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/check_goals |
RTM API equivalent | - |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
customer_fields | Yes | object | key:value format |
group_id | Yes | number | |
page_url | Yes | string |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/check_goals?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"page_url": "https://mypage.com",
"customer_fields": {
"field1": "value1"
},
"group_id": 0
}'
Get Form
Returns an empty ticket form of a prechat or postchat survey.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_form |
RTM API equivalent | get_form |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
group_id | Yes | number | Id of the group from which you want the form. |
type | Yes | string | Form type; possible values: prechat or postchat |
Response
Field | Notes |
---|---|
enabled | If enabled: false , the form object is not returned. Prechat/postchat survey disabled in the LiveChat Agent App UI. |
form | The form object |
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/get_form?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"group_id": 0,
"type": "prechat"
}'
{
"form": {
"id": "156630109416307809",
"fields": [
{
"id": "15663010941630615",
"type": "header",
"label": "Welcome to our LiveChat! Please fill in the form below before starting the chat."
},
{
"id": "156630109416307759",
"type": "name",
"label": "Name:",
"required": false
},
{
"id": "15663010941630515",
"type": "email",
"label": "E-mail:",
"required": false
}
]
},
"enabled": true
}
Get Predicted Agent
Gets the predicted Agent - the one the Customer will chat with when the chat starts. To use this method, the Customer needs to be logged in, which can be done via the login
method.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_predicted_agent |
RTM API equivalent | get_predicted_agent |
Webhook | - |
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/get_predicted_agent?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{}'
{
"id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
"name": "Name",
"avatar": "https://example.avatar/example.com",
"is_bot": false,
"job_title": "support hero",
"type": "agent"
}
Get URL Details
It returns the info on a given URL.
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/get_url_details |
RTM API equivalent | get_url_details |
Webhook | - |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
url | Yes | string | Valid website URL |
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/get_url_details?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"url": "https://livechatinc.com"
}'
{
"title": "LiveChat | Live Chat Software and Help Desk Software",
"description": "LiveChat - premium live chat software and help desk software for business. Over 24 000 companies from 150 countries use LiveChat. Try now, chat for free!",
"image_url": "s3.eu-central-1.amazonaws.com/labs-fraa-livechat-thumbnails/96979c3552cf3fa4ae326086a3048d9354c27324.png",
"image_width": 200,
"image_height": 200,
"url": "https://livechatinc.com"
}
Mark Events As Seen
Specifics
Method URL | https://api.livechatinc.com/v3.1/customer/action/mark_events_as_seen |
RTM API equivalent | mark_events_as_seen |
Webhook | events_marked_as_seen |
Request
Parameter | Required | Data type | Notes |
---|---|---|---|
chat_id | Yes | string | |
seen_up_to | Yes | string | RFC 3339 date-time format |
Response
No response payload (200 OK
).
REQUEST
curl -X POST \
'https://api.livechatinc.com/v3.1/customer/action/mark_events_as_seen?license_id=<license_id>' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <customer_access_token>' \
-d '{
"chat_id": "PJ0MRSHTDG",
"seen_up_to": "2017-10-12T15:19:21.010200Z"
}'
Webhooks
Here's what you need to know about webhooks:
- Webhooks notify you when specific events occur.
- They can be generated by both Web and RTM API actions.
- When using RTM API, you can be also notified about events with pushes.
- Webhooks and pushes have similar payloads.
Errors
{
"error": {
"type": "misdirected_request",
"message": "Wrong region",
"data": {
// optional
"region": "dal"
}
}
}
Possible errors
Error type | Default message | Description |
---|---|---|
authentication | Authentication error | An invalid or expired access token. |
authorization | Authorization error | User is not allowed to perform the action. |
customer_banned | Customer is banned | The customer had been banned. |
entity_too_large | Upload limit exceeded (10MB). | Client's request is too large. |
greeting_not_found | Greeting not found | |
group_not_found | Group not found | |
group_offline | Group is offline | Thrown in response to Get Predicted Agent. |
group_unavailable | No agent available for group | Thrown in response to Get Predicted Agent. The group is online, but there are no available Agents. |
groups_offline | Groups offline | |
internal | Internal server error | |
license_expired | License expired | The end of license trial or subcription. |
license_not_found | License not found | License with the specified ID doesn't exist. |
misdirected_request | Wrong region | Client's request should be performed to another region. The correct region is returned in the optional data object. It helps to figure out where the client should be connected. |
request_timeout | Request timed out | Timeout threshold is 15 seconds. |
too_many_requests | Too many requests | The request's rate limit was exceeded. It'll be unblocked automatically after some time. |
unsupported_version | Unsupported version | Unsupported protocol version. |
validation | Wrong format of request | |
wrong_product_version | Wrong product version | License is not LiveChat 3 (probably still LiveChat 2). |
Contact us
If you found a bug or a typo, you can let us know directly on GitHub. In case of any questions or feedback, don't hesitate to contact us at developers@livechat.com. We'll be happy to hear from you!