Interface

Actions

Actions

Members

# static AttachFile

Attach a file to the message input
Properties:
Name Type Attributes Description
name "AttachFile"
payload Actions.ChatActionPayload | Actions.ChatActionAttachFilePayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
file File Media file to be attached
Example
Actions.invokeAction("AttachFile", { file: File, channelSid: "unique_channel_identifier" });

# static DetachFile

Detach a file from the message input
Properties:
Name Type Attributes Description
name "DetachFile"
payload Actions.ChatActionPayload | Actions.ChatActionAttachFilePayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
file File Media file to be attached
Example
Actions.invokeAction("DetachFile", { file: File, channelSid: "unique_channel_identifier" });

# static DownloadMedia

Download the media from the message
Properties:
Name Type Attributes Description
name "DownloadMedia"
payload Actions.ChatActionPayload | Actions.ChatActionDownloadMediaPayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
message Message Represents the message object. See structure here: https://media.twiliocdn.com/sdk/js/chat/releases/3.2.4/docs/Message.html
Example
Actions.invokeAction("DownloadMedia", { message: message });

# static MinimizeChat

Minimize chat
Properties:
Name Type Description
name "MinimizeChat"
Example
Actions.invokeAction("MinimizeChat");

# static RestartEngagement

Restart Engagement.
Properties:
Name Type Description
name "RestartEngagement"
Example
Actions.invokeAction("RestartEngagement");

# static SendMediaMessage

Send media message.
Properties:
Name Type Attributes Description
name "SendMediaMessage"
payload Actions.ChatActionPayload | Actions.ChatActionSendMediaMessagePayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
file File Media file to send.
messageAttributes any <optional>
Represents chat message attributes to set.
Example
Actions.invokeAction("SendMediaMessage", { file: file, channelSid: "unique_channel_identifier" });

# static SendMessage

Send message.
Properties:
Name Type Attributes Description
name "SendMessage"
payload Actions.ChatActionPayload | Actions.ChatActionSendMessageTextPayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
body string Content of the message.
messageAttributes any <optional>
Represents chat message attributes to set.
useSeparateInputStore boolean <optional>
If set to true, will store the message text in separate state and improves performance.
Example
Actions.invokeAction("SendMessage", { body: "some text", channelSid: "unique_channel_identifier" });

# static SendTyping

Send typing indicator.
Properties:
Name Type Attributes Description
name "SendTyping"
payload Actions.ChatActionPayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
Example
Actions.invokeAction("SendTyping", { channelSid: "unique_channel_identifier" });

# static SetInputText

Set message input text.
Properties:
Name Type Attributes Description
name "SetInputText"
payload Actions.ChatActionPayload | Actions.ChatActionInputTextPayload
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
body string Content of the message.
selectionStart number <optional>
Represents the cursor position or the selection start position in the message body.
selectionEnd number <optional>
Represents the selection end position in the message body.
useLocalState boolean <optional>
Deprecated - If set to true, it keeps the message value in the local component state.
useSeparateInputStore boolean <optional>
If set to true, will store the message text in separate state and improves performance.
Example
Actions.invokeAction("SetInputText", { body: "some text", channelSid: "unique_channel_identifier" });

# static StartEngagement

Start Engagement.
Properties:
Name Type Description
name "StartEngagement"
payload Actions.StartEngagementPayload
formData Object Represents pre engagement form data. This object will be available in `channel.attributes.pre_engagement_data`.
Example
Actions.invokeAction("StartEngagement", { formData: someFormData });

# static ToggleChatVisibility

Toggle chat visibility.
Properties:
Name Type Description
name "ToggleChatVisibility"
Example
Actions.invokeAction("ToggleChatVisibility");

Type Definitions

Actions.ChatActionPayload

# ChatActionAttachFilePayload

Properties:
Name Type Description
file File Media file to be attached
Actions.ChatActionPayload

# ChatActionDownloadMediaPayload

Properties:
Name Type Description
message Message Represents the message object. See structure here: https://media.twiliocdn.com/sdk/js/chat/releases/3.2.4/docs/Message.html
Actions.ChatActionPayload

# ChatActionInputTextPayload

Properties:
Name Type Attributes Description
body string Content of the message.
selectionStart number <optional>
Represents the cursor position or the selection start position in the message body.
selectionEnd number <optional>
Represents the selection end position in the message body.
useLocalState boolean <optional>
Deprecated - If set to true, it keeps the message value in the local component state.
useSeparateInputStore boolean <optional>
If set to true, will store the message text in separate state and improves performance.

# ChatActionPayload

Properties:
Name Type Attributes Description
channelSid string <optional>
Unique identifier of the channel.
channel ChannelState <optional>
Represents a remote chat channel.
Actions.ChatActionPayload

# ChatActionSendMediaMessagePayload

Properties:
Name Type Attributes Description
file File Media file to send.
messageAttributes any <optional>
Represents chat message attributes to set.
Actions.ChatActionPayload

# ChatActionSendMessageTextPayload

Properties:
Name Type Attributes Description
body string Content of the message.
messageAttributes any <optional>
Represents chat message attributes to set.
useSeparateInputStore boolean <optional>
If set to true, will store the message text in separate state and improves performance.

# StartEngagementPayload

Properties:
Name Type Description
formData Object Represents pre engagement form data. This object will be available in `channel.attributes.pre_engagement_data`.