Add-on API Tutorial
U kunt Userlike verbinden met uw custom back-end of legacy CRM. Wordt op de hoogte gehouden van interacties met uw bezoekers en klanten, monitor uw operator states en resources met deze callback API addon. Registreer voor een set van events waarvoor u een HTTP POST callback ontvangt naar uw eindpunt.
In the add-on settings, enter the callback URL of your API endpoint. HTTP and HTTPS are supported as protocols. We will POST the data to your URL as a JSON document with the content type `application/JSON`. The callback URL you enter has to be accessible and needs to return an HTTP 200 code after receiving the POST request.
The calls are grouped into five dedicated formats that are identified by the `_type` field. The data formats are explained in detail further below.
|Denotes a conversation session.|
|Denotes a conversation.|
|Denotes a Widget.|
|Denotes an operator state change.|
You can configure your add-on and subscribe to a set of events that you would like to receive a callback for.
|A new conversation session is started.|
|A contact sends a message in a conversation.|
|An operator sends a message in a conversation.|
|A conversation session ends with messages not yet read by an operator.|
|A conversation session ends.|
|A conversation’s status is set to **ended**.|
|A conversation is assigned to another operator (group).|
|A contact leaves a conversation rating.|
|A contact leaves feedback on a conversation.|
|A contact answers the survey after a conversation was set to **ended**.|
|A goal is reached.|
|An operator goes online.|
|An operator goes offline.|
|An operator goes away.|
|An operator switches from away to online.|
|A Widget’s configuration is changed.|
Below you find code samples for each callback.
A new conversation session is started. Example
A contact sends a message in a conversation. Example
An operator sends a message in a conversation. Example
A conversation session ends. Example
A conversation session ends with messages not yet read by an operator. Example
A conversation’s status is set to **ended**. Example
A conversation is assigned to another operator (group). Example
A contact leaves a conversation rating. Example
A contact leaves feedback on a conversation. Example
A contact answers the survey after a conversation was set to **ended**. Example
A goal is reached. Example
An operator goes online. Example
An operator goes offline. Example
An operator goes away. Example
An operator switches from away to online. Example
A Widget’s configuration is changed. Example
Sending conversations to the API
Once you’ve configured the add-on API, you can send conversations to it via the **$api** command or the Action Bar in conversations.
To send multiple conversations to the API, use the bulk action menu under **All conversations** in the Message Center.