Returned Conversations Client instance is not yet fully initialized. Calling any operations will block until it is. Use connection events to monitor when client becomes fully available (connectionStateChanged with state 'connected') or not available (connectionStateChange with state 'denied', event tokenExpired, event connectionError).
Access token
Options to customize the Client
A not yet fully-initialized client.
Fired when the connection is interrupted for an unexpected reason.
Parameters:
data
- info object provided with the event. It has the
following properties:terminal
- Twilsock will stop connection attempts if truemessage
- the error message of the root causehttpStatusCode
- http status code if availableerrorCode
- Twilio public error code if availableFired when the connection state of the client has been changed.
Parameters:
state
- the new connection stateFired when a conversation becomes visible to the client. The event is also triggered when the client creates a new conversation. Fired for all conversations that the client has joined.
Parameters:
conversation
- the conversation in questionFired when the client joins a conversation.
Parameters:
conversation
- the conversation in questionFired when the client leaves a conversation.
Parameters:
conversation
- the conversation in questionFired when a conversation is no longer visible to the client.
Parameters:
conversation
- the conversation in questionFired when the attributes or the metadata of a conversation have been updated. During conversation's creation and initialization, this event might be fired multiple times for same joined or created conversation as new data is arriving from different sources.
Parameters:
data
- info object provided with the event. It has the
following properties:conversation
- the conversation in questionupdateReasons
- array of reasons
for the updateFired when the client initialization failed.
Parameters:
data
- info object provided with the event. It has the
following property:error
- the initialization error if presentFired when the client has completed initialization successfully.
Fired when a new message has been added to the conversation on the server.
Parameters:
message
- the message in questionFired when a message is removed from the message list of a conversation.
Parameters:
message
- the message in questionFired when the fields of an existing message are updated with new values.
Parameters:
data
- info object provided with the event. It has the
following properties:message
- the message in questionupdateReasons
- array of reasons for
the updateFired when a participant has joined a conversation.
Parameters:
participant
- the participant in questionFired when a participant has left a conversation.
Parameters:
participant
- the participant in questionFired when a participant's fields have been updated.
Parameters:
data
- info object provided with the event. It has the
following properties:participant
- the participant in questionupdateReasons
- array of reasons
for the updateFired when the client has received (and parsed) a push notification via one of the push channels (apn or fcm).
Parameters:
pushNotification
- the push notification in
questionFired when the token is about to expire and needs to be updated.
Fired when the token has expired.
Fired when a participant has stopped typing.
Parameters:
participant
- the participant in questionFired when a participant has started typing.
Parameters:
participant
- the participant in questionFired when the properties or the reachability status of a user have been updated.
Parameters:
data
- info object provided with the event. It has the
following properties:user
- the user in questionupdateReasons
- array of reasons for the
updateClient connection state.
Parse a push notification payload.
Static method for push notification payload parsing. Returns parsed push as a PushNotification object.
Push notification payload.
Current version of the Conversations client.
Current version of the Conversations client.
Client reachability state. Throws an error if accessed before the client initialization was completed.
Information of the logged-in user. Before client initialization, returns an uninitialized user. Will trigger a Client.userUpdated event after initialization.
Create a conversation on the server and subscribe to its events. The default is a conversation with an empty friendly name.
Options for the conversation.
Returns rich content templates belonging to the account. Rich content templates can be created via the Twilio console or the REST API.
Get a known conversation by its SID.
Conversation sid
Get a known conversation by its unique identifier name.
The unique identifier name of the conversation.
Get the current list of all the subscribed conversations.
Get a list of subscribed user objects.
Get content URLs for all media attachments in the given set using a single operation.
Set of media attachments to query content URLs.
Get content URLs for all media attachments in the given set of media sids using a single operation.
Set of media sids to query for the content URL.
Gets a user with the given identity. If it's in the subscribed list, then return the user object from it; if not, then subscribe and add user to the subscribed list.
Identity of the user.
A fully initialized user.
Handle push notification payload parsing and emit the Client.pushNotification event on this Client instance.
Push notification payload
Clear existing registrations directly using provided device token. This is useful to ensure stopped subscriptions without resubscribing.
This function goes completely beside the state machine and removes all registrations. Use with caution: if it races with current state machine operations, madness will ensue.
Channel type.
Push notification ID provided by the FCM/APNS service on the platform.
Register for push notifications.
Channel type.
Push notification ID provided by the FCM/APNS service on the platform.
Gracefully shut down the client.
Unregister from push notifications.
Channel type.
Update the token used by the client and re-register with the Conversations services.
New access token.
Static method for push notification payload parsing. Returns parsed push as a PushNotification object.
Push notification payload.
Populate the client with init registrations.
The init registration to populate.
A client is the starting point to the Twilio Conversations functionality.