Chat Namespace
The Chat namespace includes methods that allows you to send and receive chat messages.
The ConversationChatMessage object
ConversationChatMessage objects represent the specific interactions that have taken place in the Chat:
id: A unique identifier for the conversation message.conversation_id: A unique identifier of the parent conversation.user_id: A unique identifier for the subscriber.ts: The timestamp, in Unix Epoch, when the message was created.details: Additional metadata associated with the conversation.type: The type of the conversation message.subtype: The subtype of the conversation message.
Here is an example of a ConversationChatMessage object:
Methods
getMessages
- getMessages(
options):Promise<{ data: ConversationChatMessage[], hasNext, hasPrev, nextPage(), prevPage() }>
Returns the list of chat messages for a given addressId.
Parameters
Returns
Promise<{ data: Address[], hasNext, hasPrev, nextPage(), prevPage() }>
Example
subscribe
- subscribe(
options):{cancel()}
Returns a list of Addresses.
Parameters
Returns
An object will be returned with a cancel() function which can be used to unsubscribe to the event.
Example
sendMessage
- sendMessage(
options):Promise<Conversation>
Send a Chat Message to a given Address ID. If no Conversation exists with that Address ID, one will be created.
This is the same function as conversation.sendMessage.
Parameters
Example
join
- join(
options):Promise<JoinConversationResponse>
Joins a conversation given an address without having to send a message. Does nothing if you
were already joined to the conversation. This is the same function as conversation.join.
You automatically join a conversation when you send the first message to an address. The join
method allows you to join a conversation without first sending a message.