Conversation Namespace
The Conversation namespace includes methods that give you access to Conversation and ConversationMessage objects.
The Conversation Object
Conversation objects represent interaction pairs between Subscribers and Addresses. Each Conversation object has the following properties:
Here is an example of a Conversation object:
The ConversationMessage object
ConversationMessage objects represent the specific interactions that have taken place in the Conversation:
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.kind: The kind of the conversation message.
Here is an example of a ConversationMessage object:
Methods
getConversations
- getConversations():
Promise<{ data: Conversation[], hasNext, hasPrev }>-
Returns a list of Conversation objects.
Returns
Promise<{ data: Conversation[], hasNext, hasPrev }>
Example
getConversationMessages
- getConversationMessages(
options):Promise<{ data: ConversationMessage[], hasNext, hasPrev }>
Returns a list of ConversationMessage objects inside a Conversation with an Address ID.
Parameters
Returns
Promise<{ data: ConversationMessage[], hasNext, hasPrev }>
Example
getMessages
- getMessages(
options):Promise<{ data: ConversationMessage[], hasNext, hasPrev }>
Returns a list of ConversationMessage objects without filtering by Address ID.
Parameters
Returns
Promise<{ data: ConversationMessage[], hasNext, hasPrev }>
Example
subscribe
- subscribe():
Promise<void>
Subscribe to receive new ConversationMessage objects as they happen.
Returns
Promise<void>
Example
sendMessage
- sendMessage(
options):Promise<Conversation>
Sends a Chat Message to the Conversation. This is the same function as chat.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 chat.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 sending a message.