Share feedback, ideas and get community help

Updated 3 months ago

Rotate name list.

I need to create a flow that rotates between 4 sellers, when the customer chooses to be the first time in the chat and that the seller's name is not repeated in different accesses. so when the last of the 4 is displayed, the first one returns to be displayed and so on. I am not able to make the JS display in the text block.
{{
if ({{lastDisplayedName}} === {{names}}[{{names}}.length - 1]) {
{{lastDisplayedName}} = {{names}}[0];
} else {
{{lastDisplayedName}} = {{names}}[{{names}}.indexOf({{lastDisplayedName}}) + 1];
}
return {{lastDisplayedName}};
}}

Anyone help me!!!
N
2 comments
You could try to use the redirect module.
I did something similar like this...probably could be applicable in your usecase
Attachment
image.png
Add a reply
Sign up and join the conversation on Discord