Crisp lets you push events from the Crisp chatbox. If, however, you'd like to push those events from your backend instead, there's a way to do it via the Crisp REST API. This article explains how to do so.

First of all, you need to connect your backend to the Crisp APIs. Read this introduction article on how to do it.

Once you are done, you will follow this integration process (explained in details below):

Your backend can reach the Crisp APIs
In order to push an event to an user profile in your website, we need their people_id (ie. profile identifier)
You can set the people_id straight as the user email (the API does the job of matching an email being passed as people_id)

The people_id reference value is an identifier, which does not change for a given profile whenever you change its associated email. You can still pass in an email value as the people_id value in a request; the API will do the job of matching the email to an identifier internally, which is more convenient in most use cases.

Okay! Lets proceed now.

Push the event to the user profile

You may push an event by submitting an event data:

{
"text": "basket:item:added",
"color": "blue",

"data": {
"product": "iPhone X"
}
}


As a HTTP POST to the following route: /website/{website_id}/people/events/{people_id}, where website_id is your Crisp website identifier (it does not change), and people_id, here, is your user email value (you can also pass in a people_id identifier, if you already have it).

Here's an example formatted route: /website/04ed9a29-ccda-4f46-b2f3-b151d2d90fa7/people/events/valerian@crisp.chat, which would give the following full URL to Crisp API: https://api.crisp.chat/v1/website/04ed9a29-ccda-4f46-b2f3-b151d2d90fa7/people/events/valerian@crisp.chat.

This route is explained in the docs for the people profile event route.
Was this article helpful?
Thank you!