no-translate

Message webhooks

Complete list of all message events you can subscribe to
Napisany przez Konstantine
Zaktualizowano 2 lata temu

We recommend to read through Webhooks overview and Setting up webhooks articles before you proceed with this one.

Currently, you can subscribe to chatcustomer, and message events only. Feel free to chat us with your feedback on the missing events you'd like to use.

All webhook events contain the same attributes, listed below.

Field Type Description
event String Chat or customer event type
eventData Object A container for the data associated with the event
attempts Integer Number of times this event has been attempted
lastAttemptAt Date (UNIX timestamp) The last time the event delivery was attempted
createdAt Date (UNIX timestamp) Date and time the event was created
id String Unique event id provided by HelpCrunch

📢 Message Events

Event Type Description
message.chat.customer New incoming chat message sent by a customer
message.email.customer New incoming email message sent by a customer
message.private New private message sent by a team member
message.chat.agent New chat message sent by a team member
message.email.agent New email message sent by a team member

When the message event occurs, HelpCrunch sends the HTTP request to the specified endpoint. You can extract all the available message attributes from the eventData structure in the request body, including basic information about the customer (id, name, email and userId) and chat (id).

You can use chat id and customer id from any message event to call Get a single chat and Get a single customer REST API methods.


Message Model for Webhooks

Example Response

{
    "event": "message.chat.customer",
    "eventData": {
      "chat_id": 5224081,
      "agent": null,
      "customer": {
        "id": 8745474,
        "name": "Paul",
        "email": "[email protected]",
        "userId": "example_9106"
      },
      "message": {
        "applicationId": 77,
        "broadcastType": null,
        "createdAt": "1638953586.915",
        "edited": false,
        "id": 38488,
        "read": false,
        "text": "Thanks! Have a nice day.",
        "updatedAt": "1638953586.915"
        }
      },
    "attempts": 0,
    "lastAttemptAt": 1638953588,
    "createdAt": 1638953588,
    "id": "73499e69-285c-44c3-8431-a843ed08183d"
  }


eventData Object for Message Events

Field Type Description
event String Event type
chat_id Integer Unique internal chat id
agent Object

Team member info, including:

  • unique internal team member id
  • name
  • email
  • role
customer Object

Basic customer info, including:

  • unique internal customer id
  • name
  • email
  • unique id of the customer that you can pass to HelpCrunch with User Authentication
message Object

Message information, including:

  • unique internal message id
  • unique internal application id the message sent from (GET all applications method in REST API)
  • text, or unique internal attachment id
  • read status
  • Date and time the message was created (UNIX timestamp)

If you have any questions regarding our Webhooks, feel free to chat us any time. 

👩‍💻 Happy Coding! 👨‍💻

Czy odpowiedzieliśmy na Twoje pytanie?