Virtual Agent action scripts
-
- UpdatedMar 3, 2025
- 8 minutes to read
- Yokohama
- Virtual Agent
You need to write a set of mandatory Workflow Studio action and subflow scripts to pass the user data to VACS, apply transformations and send the response back to your chat interface endpoint.
Provider and inbound/outbound scripts
A provider, such as Twilio, provides the chat capability. User action scripts perform provider actions, as well as conversational custom chat integration configuration for inbound and outbound transformer actions for your chatbot or custom conversations. Examples of each script are provided. They include a description of what each script does, as well as the action input and action output. You also see examples of the script JSON.
You use Workflow Studio to build these scripts to transform server and client messages. The provider, sender, and inbound/outbound transformer scripts are required. You can use the additional scripts to add more functionality to your chat.
Provider attributes action script
Input | Output |
---|---|
|
|


Example: Provider attributes action script.
Sender subflow
Instead of a script, the sender subflow handles the process of sending a message to a provider. The message is contained in a payload string as part of the subflow. The sender has a service_url and origin_service_url, while the outbound URL varies depending on the provider. For example, a message sent through MS Teams uses the value tenant_id. When the Virtual Agent sends the message containing options, the recipient selects an option. The subflow updates the message display based on their choice and removes the options. The conversation continues based on the user’s selected option. The Virtual Agent is freed to continue processing messages rather than trying to send external requests. When creating a subflow do not have an action call an action within the subflow. For more information on subflows, see Subflows and actions.
Contextual action script
The contextual action script performs special keyword actions such as typing agent while inside a Virtual Agent topic to get immediately handed off to a live agent.
Input | Output |
---|---|
|
None |
Example: Contextual action script.
Link account action script
The link account action script contains identifiers for the user who is linking. The script also contains the account that it is linked to.
Input | Output |
---|---|
|
None |
Example: Link account action script.
Response processor action script
The response processor action script performs specialty actions that are based on the response to a send message request. The framework already does basic message status tracking.
Input | Output |
---|---|
|
None |
Example: Response processor action script.
Outbound transformer scripts
The outbound transformer scripts convert outgoing Virtual Agent messages to a protocol that is related to the conversational custom chat integration.
Input.
- rich_control (JSON) - Virtual Agent server rich control component that must be transformed.
- payload (JSON) - Last response that was received from a requester.
Output.
result (String) - Provider-appropriate component message to send.
Inbound transformer scripts
The inbound transformer scripts convert incoming conversational custom chat integration messages to a protocol that the Virtual Agent recognizes. It determines the required value to be injected into the rich control that is presented to the user.
Input.
- request_context (JSON) - The request passed from the Provider Attribute script.
- rich_control (JSON) - The last rich control sent to the requester that contains the original "question".
Output.
- value - sys_id or text value.
- search_text - Text that is used if the requester selected something that was unexpected. For example, a user typed something that the NLU could assist with, such as, "None of these options match what I want" in response to a topic picker component.
Inbound transformer name | Script example |
---|---|
Virtual Agent - SMS Twilio
Adapter
Default Text Inbound Transformer Purpose: Find the text response to the InputText question posed |
|
Virtual Agent - SMS Twilio
Adapter
Default Picker Inbound Transformer Purpose: Find the sys_id of the option that the user selected for this picker question. This script uses the same algorithm of the outbound transformer. If no options are selected, and the user typed something instead, then the "search_text" is set and fed into NLU if it is enabled on this instance. |