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

Chat

Guides

Additional information about this section

Main Entity

The API's main object

Endpoints

The endpoints exposed by this API

  • POST

    Sends a text message to a specific channel (AKA chat) on behalf of the site owner

Webhooks
  • Message

    This event is spread as onNewMessage webhook

About Wix Chat

Wix Chat allows Wix site owners to communicate with their site visitors through a chatbox installed on their website.

Important:
The Wix Chat API is incomplete.

With the Wix Chat API, you can:

  • Listen for new messages from site visitors
  • Send messages to site visitors (the site owner will have access to these messages via the Wix Inbox)

Was this helpful?

Channel

Attributes

NAME
TYPE
DESCRIPTION
messages

Array<object>

Latest messages in this chat (defaults to 5 messages)

state

string

One of ACTIVE, ARCHIVED, DELETED.

participantCount

integer

Total number of participants in this channel

id

string

Channel ID

createdBy

string

Participant ID of the channel creator

type

string

One of PRIVATE, GROUP.

createdDate

string

Creation date

Was this helpful?

Send Message

Sends a text message to a specific channel (AKA chat) on behalf of the site owner

Authorization

This API requires an authorization header - pass the access token from the OAuth installation flow.

Permissions

The API requires CHAT.MANAGE_CHAT

POST

https://www.wixapis.com/chat/v1/channels/{channelId}/messages

Path Params

NAME
TYPE
DESCRIPTION
channelId
Required

string

Chat ID this message is part of

Body Params

NAME
TYPE
DESCRIPTION
type

string

One of TEXT.

Message type (e.g., text, image, file). Currently only text is supported

payload

object

Message payload

metadata

object

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

Response Object

Send Message Response

NAME
TYPE
DESCRIPTION
message

object

Message that was sent

Status/Error Codes

The response will include an HTTP status code.

Was this helpful?

Request

curl

Copy Code
1curl -X POST \
2 https://www.wixapis.com/chat/v1/channels/3762db18-9231-41db-bfc6-0adcdf01c41d/messages \
3 -H 'authorization: <AUTH>' \
4 -H 'cache-control: no-cache' \
5 -H 'content-type: application/json' \
6 -d '{
7 "channelId": "3762db18-9231-41db-bfc6-0adcdf01c41d",
8 "type": "TEXT",
9 "payload": {
10 "text": "testing from rest"
11 },
12 "metadata": {}
13}'

Response

json

1
2{"message": {
3 "sequence": "1581520287964268",
4 "channelId": "3762db18-9231-41db-bfc6-0adcdf01c41d",
5 "type": "TEXT",
6 "summary": "testing from rest",
7 "participantId": "2551a0f7-65ad-430e-b073-73b842a21d1f",
8 "createdDate": "2020-02-12T15:11:27Z",
9 "metadata": {},
10 "payload": {"text": "testing from rest"},
11 "sender": {
12 "id": "8ac81d4e-45d0-426c-bd2d-2597af00dac0",
13 "role": "Admin"
14 },
15 "direction": "BusinessToVisitor"
16}}

Message

This event is spread as onNewMessage webhook

Authorization

This API requires an authorization header - pass the access token from the OAuth installation flow.

Permissions

The API requires WIX_CHAT.READ_MESSAGES

Event Body

The event's data is received as a JSON Web Token (JWT). Make sure to verify that the data was received by Wix - read more about it in the Webhooks article.

Payload

NAME
TYPE
DESCRIPTION
payload

object

Message payload

direction

string

One of 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

One of 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}
)}