Other Hooks
In this section, will quickly go through the following *fields. They are not necessarily hooks.
- params
- routes
Routes
A required field on each template. It defines where to go after the user respond.
You can define exact field mapping or regex using the prefix re:
(Java regex pattern).
Regex routes (with
re:
) are evaluated first before the non-regex mappings
If type is button
, the response is always the button name you give under the buttons
100:
type: button
message:
body: "Sample button message"
buttons:
- btn1
- Return
routes:
"btn1": 1000
"return": "MAIN_MENU"
if type is list
, the item id you give is the one matched under the routes field
1000:
type: list
message:
title: "Title"
body: "List template message"
button: "button"
sections:
"Section Title":
0:
title: Item 1
description: My item desc
"other":
title: Other
routes:
0: 2000
"other": 3000
You can make your regex matching as strict as you want. If there is no match under routes a default message is send to the user
saying that Invalid response format, please try again
.
"DOB_STAGE":
type: text
message:
- "Kindly enter your D.O.B"
- ""
- "Format: _DD/MM/YYYY_"
routes:
"re:^(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/\\d{4}$": "NEXT_STAGE"