This guide is for Flex UI 1.x.x and channels that use Programmable Chat and Proxy. If you are using Flex UI 2.x.x or you are starting out, we recommend that you build with Webchat 3.0.
The Actions Framework allows you to implement programmatic changes in Flex WebChat UI that are triggered upon certain events. You can register events before or after an action fires, or replace the behavior of an action.
Find out more about actions framework in Flex UI - Actions Framework
General
{formData?: any}
- post form data to the startEngagement URL to proceed to the in-engagement state.
Chat:
These Actions need either channel or channelSid parameter.
{channel?: ChannelState, channelSid?: string, body: string, messageAttributes?: any}
- sends message with body to channel defined by ChannelState.
{channel?: ChannelState, channelSid?: string, body: string}
- sets message edit field to body in chat UI for channel ChannelState.
{channel?: ChannelState, channelSid?: string}
- sends typing indicator execution to other party in the channel.
Posting a message on behalf of the user into the chat, after the conversation was initiated, by tapping into StartEngagement
post action event
1FlexWebChat.Actions.on("afterStartEngagement", (payload) => {2const { channelSid } = manager.store.getState().flex.session;3manager.chatClient.getChannelBySid(channelSid)4.then(channel => {5channel.sendMessage("My awesome message");6})7})