Questions

Questions are a collection of objects in which each question is an object. You can include any number of questions in the array. It accepts only a collection as the value. The collection, in turn, must have at least one map which is an input card.

Each question map in the questions array has the following keys:

  1. name
  2. replies
  3. input
  4. suggestions
Channel compatibility

     

Sample output

Use Case :

Copied//Get the visitor's interested service by a single select option input card
question1 = {"name":"type","replies":{"Cool, These are the available service, Kindly select one?"},"input":{"type":"select","options":{"Motivational Therapy","Depression Therapy"}}};
//Get the visitor's preferred date by calendar input card 
question2 = {"name":"date","replies":{{"text":"Please select your preferred Date & Time to Schedule bookings for your therapy"}},"input":{"type":"calendar","from":"+1","label":"Book Now","to":"+10","select_label":"Choose a date"}};
//Get the visitor's preferred time by slots input card 
question3 = {"name":"slot","replies":{{"text":"Okay,these are available slots, please select one!"}},"input":{"type":"timeslots","label":"Schedule appoinment","slots":{"09:00","09:00","10:00","10:30","11:00","11:30"}}};
//Get the visitor's name
question4 = {"name":"name","replies":{"May I have your name please?"}};
//Get the visitor's email address
question5 = {"name":"email","replies":{{"text":"Can you provide your email address?","validate":{"format":"email"}}}};
//Get the visitor's phone number
question6 = {"name":"number","replies":{{"text":"Can you provide you phone number"}}};
questions = Collection();
questions.insert(question1);
questions.insert(question2);
questions.insert(question3);
questions.insert(question4);
questions.insert(question5);
questions.insert(question6);
response.put("questions",questions);