Search.../
  1. Home
  2. Getting Started
  3. Overview
Generate a test token to explore our APIs

Message Webhook

This event is spread as onNewMessage webhook

Permissions

This webhook requires the Manage Chats permission scope.

Event Body

Event data is received as a JSON Web Token (JWT). It may be delayed. Be sure to verify the data was sent by Wix.

Event Data

NAME
TYPE
DESCRIPTION
payload

object

Message payload

direction

string

Supported values: BusinessToVisitor, VisitorToBusiness.

Message direction

participantId

string

Participant ID that sent this message

sequence

integer

Incremental ID (used for ordering & tracking)

metadata

object

Set of key-value pairs. Any extra data that is valuable for this message

sender

object

Message sender

type

string

Supported values: TEXT.

Message type

channelId

string

Channel ID (AKA Chat ID)

summary

string

One-line summary of the message, as displayed in the site owner's chat view

createdDate

string

Creation date

Was this helpful?

The data payload will include the following as an encoded JWT:

Event Body

json

1{
2 "data": {
3 "eventType": "<event-type>",
4 "instanceId": "<app-instance-id>",
5 "data": "<stringified-JSON>"
6 }
7}

The parsed data will include:

Sample Data

json

1
2{
3 "channelId": "3762db18-9231-41db-bfc6-0adcdf01c41d",
4 "sequence": 1581521462916708,
5 "type": "TEXT",
6 "summary": "hello from a visitor on your site",
7 "participantId": "2551a0f7-65ad-430e-b073-73b842a21d1f",
8 "createdDate": "2020-02-12T15:31:02.916Z",
9 "metadata": {},
10 "payload": {"text": "hello from a visitor on your site"},
11 "direction": "VisitorToBusiness",
12 "sender": {
13 "role": "Visitor",
14 "id": "2551a0f7-65ad-430e-b073-73b842a21d1f"
15 }
16}