Setup
To use the Messages API, install the @wix/inbox
package using npm or Yarn:
1npm install @wix/inbox
or
1yarn add @wix/inbox
Then import { messages }
from @wix/inbox
:
1import { messages } from '@wix/inbox'
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:function listMessages(conversationId: string, visibility: MessageVisibility, options: ListMessagesOptions): Promise<ListMessagesResponse>
ID of the conversation that contains the intended messages.
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.
Additional options for listing messages.
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:function sendMessage(conversationId: string, message: Message, options: SendMessageOptions): Promise<SendMessageResponse>
ID of the conversation to add the message to.
Message to send.
Additional options for sending a message.