ConversationBuilder
Tuesday, November 12, 2019 7:28 AMinterface ConversationBuilder
A Conversation Builder represents a conversation that is about to be created, fetched, or updated. You can use this object to set up or modify a conversation before showing it. Note: any changes you make here will not be sent to TalkJS immediately. Instead, instantiate a TalkJS UI using methods such as Session.createInbox.Methods
sendMessage | Sends a text message in a given conversation. |
setAttributes | Used to set certain attributes for a specific conversation |
setParticipant | Sets a participant of the conversation. |
Properties
custom {
[name: string]: string | null
} | null optional | Allows custom conversation metadata to be stored in the form { [name: string]: string } |
photoUrl string | null optional | An optional URL to a photo which will be shown as the photo for the conversation. |
subject string | null optional | An optional conversation subject which will be displayed in the chat header. |
welcomeMessages Array<string> | null optional | Messages which are sent at the beginning of a chat. In this case the messages will appear as system messages. |
Method Details
sendMessage
conversationbuilder.sendMessage(text, options): Promise<void>
Sends a text message in a given conversation.
Parameters
text string | The message body that is to be sent. | ||
options | |||
interface SendMessageOptions
|
Returns
Promise<void>setAttributes
conversationbuilder.setAttributes(attributes)
Used to set certain attributes for a specific conversation
For example:
conversation.setAttributes({subject: "Booking question"});
conversation.setAttributes({custom:
{
sold: "true",
itemId: "720"
}
});
Parameters
attributes | |||||||||
interface ConversationAttributes
|
Returns
voidsetParticipant
conversationbuilder.setParticipant(user, settings)
Sets a participant of the conversation.
This method is idempotent and can be called multiple times.
Parameters
user | A | ||||
settings Partial<ParticipationSettings> optional | An optional setting of participation, can be an initial | ||||
interface ParticipationSettings
|