Setup

To use the Messages API, install the @wix/inbox package using npm or Yarn:

Copy
1
npm install @wix/inbox

or

Copy
1
yarn add @wix/inbox

Then import { messages } from @wix/inbox:

Copy
1
import { messages } from '@wix/inbox'
Was this helpful?
Yes
No

listMessages( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves messages between the business and participant.

Up to 30 messages are returned per request. If the number of messages in a conversation is larger than 30, pagingMetadata.cursors is returned in the response, indicating that another page of results is available. To retrieve the next page of messages, pass the next cursor value in the next request's paging.cursor parameter.

To ensure you'll always retrieve the next record, use the same visibility and sorting in the first request and all subsequent requests.

By default, 30 messages are retrieved and sorted by sequence in descending order (the most recent messages are first in the list).

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Inbox Messages
Read Inbox Messages
Learn more about permission scopes.
Copy
function listMessages(conversationId: string, visibility: MessageVisibility, options: ListMessagesOptions): Promise<ListMessagesResponse>
Method Parameters
conversationIdstringRequired

ID of the conversation that contains the intended messages.


visibilityMessageVisibilityRequired
3 enum supported values:
BUSINESSBUSINESS_AND_PARTICIPANTUNKNOWN_VISIBILITY

Required. Filters for messages with the specified visibility setting.

  • BUSINESS_AND_PARTICIPANT: Return messages visible to the business and the participant.
  • BUSINESS: Return all messages.

optionsListMessagesOptions

Additional options for listing messages.

Returns
Return Type:Promise<ListMessagesResponse>
Was this helpful?
Yes
No

sendMessage( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Sends a message to the business or participant.

Specify the message type in message.content by including the appropriate object: basic, template, minimal, or form. For more information on message types and how each type renders in Inbox and the Chat widget, see Message Types.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Inbox Messages
Learn more about permission scopes.
Copy
function sendMessage(conversationId: string, message: Message, options: SendMessageOptions): Promise<SendMessageResponse>
Method Parameters
conversationIdstringRequired

ID of the conversation to add the message to.


messageMessageRequired

Message to send.


optionsSendMessageOptions

Additional options for sending a message.

Returns
Return Type:Promise<SendMessageResponse>
Was this helpful?
Yes
No