Conditional statements allow you to specify when a particular content item or forwarding or redirecting path will be selected.
- You want to provide a specific response a particular slot is not provided to then prompt for the slot value
- You want to provide a specific welcome message, by using a segment, depending on when the user was last seen
- You want redirect a user to another handler depending on if they have linked their account or not.
The following is a list of popular functions that are available. All of these return either true or false, some take parameters and some do not. You can use these functions to create a conditional strings.
They can be simple, such as a conditional if the user has been active within the last two months
or not active within two months, notice the leading exclamation point to negate the boolean the function returns:
They can also be more complex, this is for a user that is starting a session and has not linked their account yet:
isNewSession() && !hasLinkedAccount()
The following is a list of popular functions that are available.
The user has been active within the provided amount. This can be used to provide a response to a user that has used the application before but are coming back after some time and need a refresher.
activeWithin(amount: number, format: DurationFormat)
For example, the user is active within the last five days.
The available formats are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds".
The current time for the user fits within the provided schedule.
fitsSchedule(start: string, startFormat: string, durationAmount: number, durationFormat: string, timeZone?: string)
fitsSchedule("2019-09-11T00:00", "YYYY-MM-DDTmm:ss", 5, "days")
Is Request Type
Note: These do not have parameters.
To match based on the ID of the request:
isRequestID(id: string | string)
You can either provide a single string or an array of strings.
which will return true for either of the two IDs provided.
slotEquals(name: string, value: string)
slotEquals("university", "University of Virginia")
Required condition and one of two possibilities
REQUIRED && (OPTION_1 || OPTION_2)
fitsSchedule("2019-09-11T18:40", "YYYY-MM-DDTmm:ss", 210, "minutes") && ( slotEquals("team", "one") || slotEquals("team", "two")
Please sign in to leave a comment.