Other Hook
More on hooks + a lot more
In this section, will quickly go through the following *fields. They are not necessarily hooks.
- routes
- params
- router
- checkpoint
Routes
A required field on each template. It defines where to go after the user respond.
Prefix regex routes with re:
followed by any Java regex pattern
Routes can either be regex pattern or exact words
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:
- My button
- Return
routes:
"my button": 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: "CTA"
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"