0

I've found out that it's faster to get a reply here than in Twilio's support, so here it goes: I need to ask the user 3 questions, however, if the first answer is yes, there will be an extra question right on the spot.

Is it possible to do it on the same Collect?

Thank you.

2 Answers2

0

Please provide snippets but I shall attempt to answer the question to the best of my ability. If you are referring to the programmable chat function, I would also need to see the language you are using, although:

Create a variable, after asking the question, assign the variable to read the input, here's a basic example in VB.NET:

Dim ans As String
Console.WriteLine("Question")
ans = Console.ReadLine()
if (ans = "y")
{
Console.WriteLine("Different Question depending on the scenario")

}

if (ans = "n")
{
Console.WriteLine("Next Question")
Recursion()
/* Recursion the question that both y/n will both have*\
}
yosh
  • 178
  • 15
  • I'm sorry I wasn't clear, I was referring to the Autopilot's Collect function. The language my webhook's are on is Python. Thank you for answering! – Lucas Leite Oct 09 '19 at 14:11
0

Twilio developer evangelist here.

You can't do that within the same collect as there is no inherent logic in the flow through the JSON.

In my experience, if I needed a conversation to branch at some point that would be the end of one collect and I would start a new one based on the response. You can still remember all of the details throughout the conversation using the remember function.

philnash
  • 70,667
  • 10
  • 60
  • 88