Chat webhooks

Complete list of all chat events you can subscribe to
Written by Konstantine
Updated 3 months ago

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

💬 Chat Events

Event Type Description
chat.new New chat created by any customer
chat.status_updated Chat status updated either manually or automatically (e.g when agent replies to a New chat and the status automatically changes to Opened)
chat.assigned Chat assignee updated either manually or automatically (e.g when agent replies and auto-assigns the chat to themselves)
chat.snoozed Chat snoozed for later
chat.unsnoozed Chat unsnoozed
chat.closed Chat closed by agent or by customer
chat.rated Chat rated by customer

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

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


Chat Model for Webhooks

Example Response

{
    "event": "chat.snoozed",
    "eventData": {
      "communicatedAgents": [
        2924
      ],
      "customer": {
        "id": 8745474,
        "name": "Paul",
        "email": "paul.hunter@example.com",
        "userId": "example_9106"
      },
      "closedBy": "customer",
      "status": "closed",
      "closedAt": "1607542030.713",
      "rating": "great",
      "createdAt": "1607540767.414",
      "snoozedUntil": "1606155714.000",
      "applicationId": 89,
      "applications": {
        743,
        42
      },
      "department": {
        "id": 233231,
        "name": "Sales"
      },
      "lastCustomerMessageAt": "1607540767.166",
      "chat_id": 5224081,
      "assignee": {
        "id": 2924,
        "name": "Paul",
        "email": "pavel@helpcrunch.com",
        "role": "admin"
      },
      "lastMessage": {
        "id": 9685301,
        "text": "set_rating",
        "createdAt": "1607542030.679"
      }
    },
    "attempts": 0,
    "lastAttemptAt": 1607542030,
    "createdAt": 1607542030,
    "id": "252041ed-62a7-4303-81f9-842ec6e8d18f"
  }


eventData Object for Chat Events

Field Type Description
event String Event type
communicatedAgents Array of integers Array of agent ID's. You can fetch agents' info (id, name, email, role) with Get all team members REST API method.
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
closedBy String "customer" or "agent". Who closed the chat
closedAt Date (UNIX timestamp) Date and time the chat was closed
status String Current chat status: "new", "open", "pending", "on-hold", "closed", "no communication", "empty".
rating String Chat rating for closed chats: "poor",  "average" or "great"
createdAt Date (UNIX timestamp) Date and time the chat was created
snoozedUntil Date (UNIX timestamp) Date and time the chat was snoozed until
applicationId Integer Unique internal ID of the application. You can fetch application info (id, name, active, type) with GET all applications REST API method
applications Array All internal application IDs that a customer used to send messages. You can fetch application info with GET all application REST API methof
department Object Department the chat is currently assigned to. Consists of unique internal department id and name.
lastCustomerMessageAt Date (UNIX timestamp) Date and time of the last message from customer
chat_id Integer Unique internal chat ID
assignee Object Agent the chat is currently assigned to. Consists of unique internal agent id, name, email and role.
lastMessage Object Information about the last message in the chat. Consists of unique internal message id, text and createdAt date. If the last message was sent from agent, the object will also contain the ID of that agent.

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

👩‍💻 Happy Coding! 👨‍💻

Read Next → Customer webhooks

Did this answer your question?