Pick a random word from an array of words

(Louis Price) #1

Was just wondering if I’m able to be able to pick from a range of words, the only way I could think of doing this is through the code function. Does anyone know the code I need to use or is this actually possible?

(Daniel Beckett) #2

Hi @Louis_Price,

I can’t help with the coding side, sorry. You could try a community like Stack Overflow for help with that.

In order to do this directly from Flow XO using actions, you’ll need to use the number service to create a randomly generated number between 1 and maximum number of responses. You’ll then create a message (or set an attribute) for each of the values which is filtered on the random number = 1, 2, etc. The flow should look something like this:

  • Flow Trigger
  • Random Number generated between 1 - 3
  • Message 1 “Hi” - filtered Random number = 1
  • Message 2 “Hello” - Filtered on Random number = 2
  • Message 3 “Hey” - Filtered on Random number = 3