Hello 👋 How can we help?

Create customer events

Written by Konstantine
Updated 1 month ago

In this API (just as in JS API) you can create new customer events, that will be displayed at that customer’s chat in “User Actions” section. For this you will need to send a POST request with the customer’s ID as GET parameter and event’s name, data and date (in “Y-m-d H:i:s” format) in the request body.

Url: https://your-organization.helpcrunch.com/api/public/events/1244343
Method: POST
Headers: Authorization: Bearer api-key=”842699d800d4df44831d8968ecfda46367717109″

Body (JSON):

[
  {
    "name": "someEvent",
    "data": "{\"title\":\"test_event_was_fired\",\"url\":\"http:\/\/yourcompanyname.helpcrunch.com\/chats\/123456\"}",
    "createdAt": "2018-11-05 13:00:00"
  },
  {
    "name": "newPurchase",
    "data": "{\"title\":\"new_purchase\",\"url\":\"http:\/\/yourcompanyname.helpcrunch.com\/chats\/123459\"}",
    "createdAt": "2018-11-05 13:25:00"
  }
]

Responses:

  • "Event(s) were added"
    You will get “401 Unauthorized” if api-key in Authorization header is wrong or absent
  • You will get “403 Access denied” if you are trying to get data from a customer that does not belong to your organization
  • You will get “404 Customers could not be found” if a customer does not exist or you sent no data
  • You will get “422 Unprocessable Entity” and “Request is not valid. Syntax error” if you use wrong customers data structure
  • You will get “200 No events found” in case of invalid request data
Did this answer your question?