WebChat Actions

What is Actions Framework?

The Actions Framework allows you to implement programmatic changes in Flex UI that are triggered upon certain events. You can register events before or after an action fires, or replace the behavior of an action.

What can you do with Actions Framework?

  • Replace native actions
  • Invoke actions from your custom components
  • Tap into pre and post action events
  • Register your custom actions and use them in your custom components

Find out more about actions framework in Flex UI - Actions Framework

WebChat Actions


  • StartEngagement - payload: {formData?: any} - post form data to the startEngagement url to proceed to the in-engagement state.
  • RestartEngagement - remove the user from the chat channel and return them to a pre-engagement stage.
  • ToggleChatVisibility - toggle the chat widget between minimized and expanded view.
  • MinimizeChat - toggle the chat widget between minimized and expanded view.


These Actions need either channel or channelSid parameter.

  • SendMessage - payload: {channel?: ChannelState, channelSid?: string, body: string, messageAttributes?: any} - sends message with body to channel defined by ChannelState.
  • SetInputText - payload: {channel?: ChannelState, channelSid?: string, body: string} - sets message edit field to body in chat UI for channel ChannelState.
  • SendTyping - payload: {channel?: ChannelState, channelSid?: string} - sends typing indicator execution to other party in the channel.

Example of using an "afterAction" event

Posting a message on behalf of the user into the chat, after the conversation was initiated, by tapping into StartEngagement post action event

          FlexWebChat.Actions.on("afterStartEngagement", (payload) => {

              const { channelSid } =;
                  .then(channel => {
                      channel.sendMessage("My awesome message");
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more