# Send message (RWC)
Use this step to send a message to an end user in a specified Rich Web Chat conversation. Step works together with the Wait for Chat (RWC) step template. When step is reached during flow execution, it sends the message to the chosen conversation and proceeds down the next exit without waiting for user’s reply.
# Message content
The outgoing message should contain a text and/or attachment(s).
The preview message button allows you to see how the user will see the message in the chat.
You can use HTML tags and inline CSS styles to customize text or add images.
# Example
<b>bold text</b>
<a href="URL">link</a>
<div style="display: flex;">
<img src="link to image" style="width: 50%;">
<img src="link to image" style="width: 50%;">
</div>
# Add media to message
Attachments (or media) can be chosen either from OneReach.ai’s storage or set as URLs.
From OneReach.ai’s storage | From URL |
---|---|
When attaching single image (without text message) image will be fully shown in chat. Otherwise attachment will have file-like appearance with small preview.
Multiple attachments | Single image attachment |
---|---|
# Single message
By default, you can send a single message by defining it via a text and/or media file(s).
# Random message
Sends one message from a list depending on probability. To create multiple messages use add new message option. Each message is defined by a text and/or media, as well as its individual weight. The weight is used to calculate the probability of that message being chosen from the list. It is expected as a positive number with point or comma used for decimals; its range is > 0 and < (2^53-1). If the weights are defined manually, the probabilities of each message being sent are calculated automatically and displayed next to each weight. When step is reached in the flow, it chooses one of the messages randomly and sends it to the end user.
# Conditional message
Condition message option allows to select the outgoing message depending on set conditions. To set up multiple messages use add condition option. Each message is defined by a text and/or media, as well as conditions that should be met for the step to select that message. There is no limit on the number of condition groups, but the step will choose only one during an execution. When step is reached in the flow, each group will be evaluated in order from top to bottom. The flow will select the first group for which the associated rules are met. If none of the rules were met, the step will send the message defined in the If no condition is met section. Additional information about condition builder can be found in the Conditional Selection step under the Info icon.
# Condition groups
Every condition group is defined by the condition rules that must be met for the flow to select that group and the data to output field, in which you specify the output data manually, via merge field values or in code mode in case that group is selected. At least one condition group must be defined.
To add a new group click + Add condition
button, to delete one click on X
button. You can change the order of your groups using the drag handle.
Each condition rule is validated for the details to be set properly. The condition group edge will be highlighted in red if any data requires correction.
The name of a group is set by default and can be manually changed. The description is empty by default and can be manually added but it is not required and will not affect the flow execution.
Valid condition group | Invalid condition group |
---|---|
# Condition rules
Each rule is created using a data type, input values and a logical operator that is predefined in a dropdown and varies depending on the chosen data type (i.e. “contains”, “starts with”, “>=”, “is empty”, “is exactly same as”, etc.). At least one rule for every condition group must be defined but you can have as many rules as you need. To add a new rule click Add rule button.
You can compare different data types, like string, number, object or array (see example below). Both input fields can be filled in manually or with a merge field value by clicking on the {x} icon. Make sure that the value stored in the merge field matches with the chosen data type. String data is case-insensitive by default but you can change this parameter in Advanced settings.
If you need to apply more complex logic for data validation, choose advanced data type and describe the query as JavaScript expression. Please note that once you switch to advanced or object or array and make any changes to the data, the data will be lost if you select another data type.
# Example of advanced data type
Input value await this.mergeFields['requestResponse'].get({path: 'filePath'})
is exactly same as:
[
'Link to first file',
'Link to second file',
'Link to third file'
]
Advance dat type expression will look like this:
await this.mergeFields['requestResponse'].get({path: 'filePath'}).length > 2
In this case condition will be met and step will send appropriate message if no other conditions were set.
# Match type
By default, all rules in one condition group are set with any match type meaning the flow select this group if at least one rule is met. Choose all if you want exact match with every condition rule.
# Conversation
Specifies conversation where message will be sent. There are two options how conversation can be set:
- Automatic
- Manual
# Manual
In order to manually specify conversation you have to turn off the Inherit context from previous step
switch in Conversation collapsible group. You will have two dropdowns where you can select bot with RWC flows and conversation that lists the merge field names of available Wait for Chat (RWC) step templates in bot flows.
WARNING
When using manual mode, beware that if you want to move or clone flow to another bot/account you would need to re-set proper bot and conversation values for each step as bot ID and conversation ID will be different.
This behavior will not occur when using automatic mode.
# Automatic
Automatic mode allows step to inherit conversation from previous step. In order to switch step to automatic conversation mode turn on Inherit context from previous step
switch in Conversation collapsible group.
When there is no previous RWC step that current step can reference from, conversation will be inherited from Wait for Chat (RWC) step.
WARNING
Be careful when mixing different conversations in flow, if one step conversation mode is set to manual and it sends message to different conversation, next messages can also inherit this conversation and instead of sending messages to current conversation it can send messages to another.
# Merge field settings
The output data of the step will be stored under the name provided in merge field name. It includes the unique identifier of the sent message and may be used by advanced users.
# Error handling
Process error is on by default and adds an error exit to the step. The flow will proceed down this exit it if any error was encountered during the execution of the step (e.g. if the chosen conversation no longer exists).
# Reporting events
Step and Transcript events are reported once the flow exits the step. They collect the data which can be used further in reports. You can specify tags to organize the collected data.