API version

RTM pushes

This document contains a reference of pushes available in the LiveChat Customer Chat API. Similarly to webhooks, pushes notify you when specific events occur. They're usually generated as result of RTM API actions, but it's also possible to receive them in result of Web API actions.

Introduction

Here's what you need to know about pushes:

  • They are generated primarily by RTM API actions, but also by Web API actions.
  • They notify you when specific events occur.
  • Can be delivered only in the websocket transport.
  • You don't need to register pushes to receive them.
  • Their equivalents in Web API are webhooks. Pushes and webhooks have similar payloads.
  • There are no retries for pushes. To determine if a customer has seen an event, compare the event's created_at parameter with the customer's events_seen_up_to field.

Available pushes

Chatsincoming_chat_thread thread_closed
Chat accessaccess_set chat_transferred
Chat userschat_user_added chat_user_removed
Eventsincoming_event event_updatedincoming_rich_message_postback
Propertieschat_properties_updated chat_properties_deleted chat_thread_properties_updated chat_thread_properties_deleted event_properties_updated event_properties_deleted
Customerscustomer_updated customer_page_updated customer_side_storage_updated
Statuscustomer_disconnected
Otherincoming_typing_indicator incoming_multicast events_marked_as_seen
The general push format
Copied!
{
  "request_id": "<request_id>", // optional, applies only to the requester
  "action": "<action>",
  "type": "push",
  "payload": {
    // optional payload
  }
}

Chats

incoming_chat_thread

Informs about a new thread coming in the chat. The push payload contains not only the new thread, but the whole chat data structure. If the chat was started with some initial events, the thread object contains them.

Sample push payload
Copied!
{
  "chat": {
    "id": "PJ0MRSHTDG",
    "order": 343544565,
    "users": [
      // array of "User" objects
    ],
    "properties": {
      // "Properties" object
    },
    "access": {
      // "Access" object
    },
    "thread": {
      // "Thread" object
    }
  }
}

thread_closed

Informs that a thread was closed.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "user_id": "b7eff798-f8df-4364-8059-649c35c9ed0c" // optional
}
Push payload
FieldNotes
user_idMissing if a thread was closed by the router.

Chat access

access_set

Informs that new, single access to a resource was set. The existing access is overwritten.

Sample push payload
Copied!
{
  "resource": "chat",
  "id": "PJ0MRSHTDG",
  "access": {
    "group_ids": [1]
  }
}
Push payload
FieldNotes
resourceResource type
idResource id

chat_transferred

Informs that a chat was transferred to a different group or to an Agent.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "requester_id": "cb531744-e6a4-4ded-b3eb-b3eb4ded4ded",
  "type": "agent",
  "ids": ["b7eff798-f8df-4364-8059-649c35c9ed0c"]
}
Push payload
FieldNotes
typeagent or group
idsAn array of the group or agent IDs

Chat users

chat_user_added

Informs that a user (Customer or Agent) was added to a chat.

This push can be emitted with user.present set to false when a user writes to a chat without joining it. You can achieve that via the Send Event method.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "user": {
    // "User > Customer" or "User > Agent" object
  },
  "user_type": "customer"
}
Push payload
FieldNotes
user_typePossible values: agent, customer
thread_idEmpty if a user was added to an inactive chat.

chat_user_removed

Informs that a user (Customer or Agent) was removed from a chat.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "user_id": "user@example.com",
  "user_type": "customer"
}
Push payload
FieldNotes
user_typePossible values: agent, customer
thread_idEmpty if a user was removed from an inactive chat.

Events

incoming_event

Informs about an incoming event sent to a chat.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "event": {
      "id": "Q20163UAHO_2",
      "created_at": "2019-12-05T07:27:08.820000Z",
      "recipients": "all",
      "type": "message",
      "properties": {
          "0805e283233042b37f460ed8fbf22160": {
              "string_property": {
                "value": "string value"
              }
          }
      },
      "text": "Hello",
      "author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c"
  }
}

event_updated

Informs that an event was updated.

Sample push payload
Copied!
{
  "chat_id": "123-123-123-123",
  "thread_id": "E2WDHA8A",
  "event": {
    // "Event" object
  }
}

incoming_rich_message_postback

Informs about an incoming rich message postback. The push payload contains the info on the postback itself, as well as the chat it was sent in.

Sample push payload
Copied!
{
  "user_id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "event_id": "a0c22fdd-fb71-40b5-bfc6-a8a0bc3117f7",
  "postback": {
    "id": "action_yes",
    "toggled": true
  }
}

Properties

chat_properties_updated

Informs about those chat properties that were updated.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "properties": {
    "rating": {
      "score": {
        "value": 1
      },
      "comment": {
        "value": "Very good!"
      }
    }
    // ...
  }
}
Push payload
FieldNotes
propertiesNot a full properties object. This push shows only the properties that have been recently updated.

chat_properties_deleted

Informs about those chat properties that were deleted.

Sample push payload
Copied!
{
    "chat_id": "PJ0MRSHTDG",
    "properties": {
        "rating": ["score", "comment"]
        },
        // ...
    }
}
Push payload
FieldNotes
propertiesNot a full properties object. This push shows only the properties that have been recently updated.

chat_thread_properties_updated

Informs about those chat thread properties that were updated.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "properties": {
    "rating": {
      "value": {
        "value": 1
      },
      "comment": {
        "value": "Very good!"
      }
    }
    // ...
  }
}
Push payload
FieldNotes
propertiesThis is not a full properties object. This push shows only the properties the have been recently updated.

chat_thread_properties_deleted

Informs about those chat thread properties that were deleted.

Sample push payload
Copied!
{
    "chat_id": "PJ0MRSHTDG",
    "thread_id": "K600PKZON8",
    "properties": {
        "rating": ["score", "comment"]
        },
        // ...
    }
}
Push payload
FieldNotes
propertiesNot a full properties object. This push shows only the properties that have been recently updated.

event_properties_updated

Informs about those event properties that were updated.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "event_id": "2_E2WDHA8A",
  "properties": {
    "rating": {
      "comment": {
        "value": "Very good!"
      }
    }
  }
}
Push payload
FieldNotes
propertiesNot a full properties object. This push shows only the properties that have been recently updated.

event_properties_deleted

Informs about those event properties that were deleted.

Sample push payload
Copied!
{
    "chat_id": "PJ0MRSHTDG",
    "thread_id": "K600PKZON8",
    "event_id": "2_E2WDHA8A",
    "properties": {
        "rating": ["score", "comment"]
        },
        // ...
    }
}
Push payload
FieldNotes
propertiesThis is not a full properties object. This push shows only the properties that have been recently updated.

Customers

customer_updated

Informs that Customer's data was updated.

Sample push payload
Copied!
{
  "customer": {
    // "User > Customer" object
  }
}

customer_page_updated

Informs that a Customer changed the website - moved to another page of the website, for example by clicking on a link.

Sample push payload
Copied!
{
  "url": "https://livechatinc.com/pricing",
  "title": "pricing",
  "timestamp": 123456789
}

customer_side_storage_updated

Informs that a Customer updated the data stored on their side.

Sample push payload
Copied!
{
  "customer_side_storage": {
    "customer_visits": "1"
  }
}
Push payload
FieldNotes
customer_side_storageA map in the key : value format. Map content should be kept on the client side (e.g. in browsers local storages) and sent via login.

Status

customer_disconnected

Informs that a Customer was disconnected. The payload contains the reason of Customer's disconnection.

Sample push payload
Copied!
{
  "reason": "misdirected_connection",
  "data": {
    // optional
    "region": "fra"
  }
}
Push payload
FieldNotes
reason

Possible reasons

TypeNotes
access_token_expiredAccess token lifetime has elapsed.
connection_timeoutHas not received ping from the client for some time, or it's been too long since the connection was authorized.
customer_bannedCustomer has been banned.
customer_temporarily_blocked*Customer tried reconnecting too many times after the too_many_connections error had occurred.
inactivity_timeoutCustomer didn't chat or change the page in the past 30 minutes.
internal_errorInternal, unexpected error; reconnecting is advised
license_not_foundThe license with the specified ID doesn't exist.
license_expiredThe license has expired.
misdirected_connection **Customer connected to a server in the wrong region.
product_version_changedThe product version has changed.
service_temporarily_unavailableThe Customer Chat API should be available again soon; reconnecting is advised
too_many_connectionsCustomer has reached the maximum number of connections.
too_many_unauthorized_connectionsThe maximum number of unauthorized connections has been reached.
unsupported_versionConnecting to an unsupported version of the Customer Chat API.

*) The misdirected_connection reason can also return the correct region in an optional data object. With this piece of information, client is able to figure out where it should be connected.

**) The customer_temporarily_blocked reason can also return the correct timeout in an optional data object. With this piece of information, client is able to figure out how much time a customer should wait before attempting to reconnect again.

Other

incoming_typing_indicator

Informs that one of the chat users is currently typing a message. The message hasn't been sent yet. The push payload contains the typing indicator object.

Sample push payload
Copied!
{
  "chat_id": "PJ0MRSHTDG",
  "thread_id": "K600PKZON8",
  "typing_indicator": {   
    "author_id": "d17cd570-11a9-45c0-45c0-1b020b7586dc",
    "recipients": "all",
    "timestamp": 1574245378,
    "is_typing": true
  }
}

incoming_multicast

Informs about messages sent via the multicast method or by the system.

Sample push payload
Copied!
{
  "author_id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
  "content": {
    "example": {
      "nested": "json"
    }
  }
}
Push payload
FieldRequiredNotes
author_idNoPresent only if the push was generated by the Multicast method and not sent from the server.
contentYes

events_marked_as_seen

Informs that a user has seen events up to a specific time.

Sample push payload
Copied!
{
  "user_id": "b7eff798-f8df-4364-8059-649c35c9ed0c",
  "chat_id": "PJ0MRSHTDG",
  "seen_up_to": "2017-10-12T15:19:21.010200Z"
}