messages.ensureRecipientStatus()
Fetches all message.statusesPerRecipient
for both 1-on-1 and group messages.
This should be called when a message is visible in the conversation (in UI), and for last messages that show up in the inbox.
If there are multiple statuses being changed at once, the server may batch them automatically.
Definition
client.messages.ensureRecipientStatus(id: string|Message,options: ?Object):Promise<MessageStatusPerRecipient[],Error>
Parameters
Parameter | Type | Description |
---|---|---|
id | string |Object | A message ID or Message object |
options | ?Object | Options (described below) |
Options
Parameter | Type | Description |
---|---|---|
includeUsers | boolean | Whether to ensure that all users are also loaded (default: false ) |
queue | boolean | If false , do not allow this request to be batched and fetch the statuses immediately (default: true ) |
Returns
An error will be thrown if any of the arguments are invalid.
Otherwise, once the returned Promise
is resolved, returns the message.statusesPerRecipient
array (of type MessageStatusPerRecipient).
Example
const statusesPerRecipient = await client.messages.ensureRecipientStatus(id: 'some-message-id',{includeUsers: 'true',queue: 'true',})message.statusesPerRecipient.forEach(function (status) {console.log(status.user.displayName, status.status, status.createdAt);});