List the messages in the current conversation. Note that the plugin context will only have access to messages that have loaded for the user. For different reasons, some messages within a conversation will not have loaded for a user, meaning that this function will return undefined for those messages. If you need to definitively load all messages for a conversation, use the Core API.
This function is only available on context of type
singleConversation
andmessageComposer
function listMessages(paginationToken?: string, cancelToken?: CancelToken): Promise<PaginatedResults<Message>>
Parameters
Parameter | Type | Description |
---|---|---|
paginationToken | PaginationToken | Token of the requested page. If omitted, will return the first page of results. |
cancelToken | Cancel token | Token to cancel the request. |
Return value
The function returns a promise that resolves with a paginated list of messages.
Property | Type | Description |
---|---|---|
nextPageToken | PaginationToken (optional) | Token to access the next page of results, if any. |
results | Array of Message | List of messages. |
Errors
Message | Description |
---|---|
The draft's conversation is not selected. | This error applies to composer plugins. It occurs when the messageComposer context for composer plugins does not have access to the conversation. To avoid this error, disable the functionality of this method whenever the conversation property does not exist in the messageComposer context. Learn more in the Context topic. |