Conditional Quick Replies

(Vila Vg) #1

Hello

I’m wondering if its possible to trigger quick replies based on certain set of conditions. For instance, if a user is asking about ‘apple’ and then after a few conversations asks about ‘orange’ I’d like to push quick replies that say ‘explore more fruits’ and ‘why eat fruits.’ (because they mentioned 2 fruits)

Similarly if they ask about ‘cabbage’ and ‘broccoli’ I’d like to push quick replies that say ‘explore more vegetables’ and ‘why eat veggies.’ (because they mentioned 2 veggies)

Any way to accomplish this?

Thanks

(John Jackson) #2

It’s certainly possible to do this, but it will take a bit of creativity :grinning:

You’d probably have to be able to use code to actually decide what quick replies to offer (maybe based off attributes set against the user).

So broadly speaking:

  • When user talks about a fruit or veg, save it to an attribute.
  • Feed those attributes into a Code Service action, then write some code that outputs a set of 3 most relevant shortcuts. Instead of using our code service, you could hit your own API using HTTP and do some processing in whatever environment you feel comfortable with.
  • On your next message, set these 3 shortcuts to be sent along with your message.

Good luck with it!

(Vila Vg) #3

@johnjackson is there a code sample of how that might look? a basic example / flow would be a great starting point for this if possible to share. thanks!