Advanced Variable Features - Map To
Map to allows you to override a variable that has been defined in a previous follow-up question.
For example: consider a scenario involving an OTP Intent with a follow-up question asking to input the OTP. Following the end user's response, the OTP is stored in an otp variable defined under Key Name. Another follow-up question is then triggered to verify the OTP, as shown below.
Note:
The screenshot displays the Callback ID as a static text. In a real situation, you'll need to supply the actual Callback ID, which can be obtained from the Callback Profile page.
In this follow-up question, a response callback is employed to perform a POST request, transmitting the value of "" – which corresponds to the 'OTP' provided in the prior question. If the API call returns 'True,' the end user progresses to the 'Success' intent; if 'False,' they are redirected to the 'Invalid OTP' intent. In the 'Invalid OTP' Intent, a follow-up question prompts the user to re-enter the OTP, this time designated as 'new-otp', so that it can be validated again in a subsequent follow-up question.
However, due to the API's requirement for a variable named 'otp,' the next API call to the OTP verification service would fail. To address this problem, you can utilize the 'Map to' option. By setting 'map to' to 'otp,' the newly entered OTP will be stored in the 'otp' variable, ensuring a successful API call for OTP verification.
Updated about 1 year ago