Conversation
A Conversation 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 widgets such as ChatBox.
NOTE: A Conversation object is created by calling the getConversation method of the Session object.
sendMessage | Sends a text message in a given conversation. |
id
: StringA unique identifier for this conversation, such as a channel name or topic ID. Any user with access to this ID can join this conversation. Read about how to choose a good conversation ID for your use case If you want to make a simple one-on-one conversation, consider using oneOnOneId to generate one.
custom
: Map<String, String?>?Allows custom conversation metadata to be stored in the form { "name": "string" }
photoUrl
: String?An optional URL to a photo which will be shown as the photo for the conversation.
subject
: String?An optional conversation subject which will be displayed in the chat header.
welcomeMessages
: List<String>?Messages which are sent at the beginning of a chat. In this case the messages will appear as system messages.
participants
(optional): Set<Participant>A set containing the participants for this conversation.
1Future<void> sendMessage(String text, {SendMessageOptions? options});
Sends a text message in a given conversation.
Parameters
text
: StringThe message body that is to be sent.
options
(optional): SendMessageOptions?Custom metadata that is stored with the message.
Returns
Future<void>
This represents a participant of the conversation.
Constructor | Sets a participant of the conversation. |
1Participant(User user, {ParticipantAccess? access, bool? notify});
Sets a participant of the conversation.
NOTE: All the parameters passed to the constructor are also available as read-only properties of the constructed object.
Parameters
user
: UserA User object that identifies the person who is a participant of the conversation.
access
(optional): ParticipantAccess.read | ParticipantAccess.readWrite | nullSpecifies the participant's access permission for a conversation.
notify
(optional): ParticipantNotification?BREAKING CHANGE: Before Flutter SDK version 0.4.0
this property was of type bool?
Specifies the participants's notification settings.
Sets custom metadata that is stored with the message.
Constructor | Sets custom metadata that is stored with the message. |
1SendMessageOptions({required Map<String, String?> custom});
Sets custom metadata that is stored with the message.
NOTE: All the parameters passed to the constructor are also available as read-only properties of the constructed object.
Parameters
custom
: Map<String, String?>Custom metadata that is stored with the message.
Set any property to null to delete the existing value (if any). When omitted, the existing value remains unchanged.