Prop

If you have been developing websites, you probably come across this word. Here, Props are custom variables that you can use however you'd like - to store data in the user session under that variable

The engine have a constant internal key for user props.

All props defined in templates are saved into a Map under the key kProps.

Defining a prop#

To define a prop on a particular template

1000:
  type: text
  prop: userName
  message: "What is your name?"
  routes:
    "re:.*": next-stage

In the above, when user provides a response, it will be saved in the user session props under the key userName

Get From Session

You can then access this data later in your program by the prop key from the user session.

A helper endpoint to get user session data by key is defined and can be accessible via

[GET request] http://localhost:8080/webhook/{user-mobile}/{session-key}

to get all user session data pass session-key as asterik *

Save To Session

You can optionally add data to the user session via the endpoint

The request body is as below

{
    "user": "user-mobile",
    "key": "data-key",
    "prop": false,
    "data": "dynamic-data-to-save"
}

If prop is true, data will be treated like template prop and saved under kProps

[POST request] http://localhost:8080/webhook/session