On this page
Replace user reply message with a component
By default, once the user submits their reply to the bot message, the chat shows the message with their reply. However, the RWC allows to replace the user reply message with a component. So when the user submits their reply, the chat shows this component instead of their reply message.
Instruction
- Open the Request Response (RWC) Step where you want to replace user reply message after submission.
- Scroll down to the Advanced settings and expand it.
- Enable the Use function to define user answer toggle. The User answer message field becomes available.
- In the User answer message field, return an object.
For example, to show the Files component, add the object with the the data structure:
js
return {
component: 'files',
data: {
files:
[
{
location: 'url here'
}
]
}
}
return {
component: 'files',
data: {
files:
[
{
location: 'url here'
}
]
}
}
To show the Rating component, add the object with the the following data structure:
js
return {
component: 'rating',
data: {
rating: '3',
feedback: 'Thanks'
}
}
return {
component: 'rating',
data: {
rating: '3',
feedback: 'Thanks'
}
}
To show the Cards component (Single Card or Carousel), add the object with the following data structure:
js
return {
component: 'cards',
data: {
options: [
{
buttonLabel: "Button label",
cardId: "cardId",
description: "Description",
title: "Card Title"
}
]
}
}
return {
component: 'cards',
data: {
options: [
{
buttonLabel: "Button label",
cardId: "cardId",
description: "Description",
title: "Card Title"
}
]
}
}
- Save & Activate the Flow.
WARNING
If you return undefined
of nothing, user reply will not be changed.