Case 1. Data Purchase
Before you begin
This tutorial requires a webhook setup. Add a test webhook URL
http://mock-webhook.mind.ai
to your webhook settings.This tutorial requires "customer_name", "customer_number" global keys in the Scope.
The entity MSISDN is going to be used for this tutorial. It can be found on the System(Extensible) tab of Entities.
MSISDN
Regex Pattern Block 1
REGEX PATTERN [nN]?[fF] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]
DESCRIPTION 9 digits: 1st digit can be n or N, 2nd digit can be f or F
Regex Pattern Block 2
REGEX PATTERN [1,2,3,6,8,9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]
?[0-9]
DESCRIPTION 7 digits: 1st digit can be 1,2,3,
6,8,9
Regex Pattern Block 3
REGEX PATTERN [1,2,3,6,8,9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]
DESCRIPTION 8 digits: 1st digit can be 1,2,3,6,8,9
Regex Pattern Block 4
REGEX PATTERN [0,1,2,6,8,9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9](-?[0-9A-Za-z])?
DESCRIPTION 10 digits with " - " in between of each digit
Regex Pattern Block 5
REGEX PATTERN [0,1,2,6,8,9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]( ?[0-9A-Za-z])?
DESCRIPTION 10 digits: 1st digit can be 0,1,2,6,8,9 and last digit can be 0-9, A-Z, a-z)
Add a Subject
Click Add Subject on the Scope details page.
Select the Query Freestyle tab.
Enter a Subject name.
Enter Query Statement which is the expected customer query as "Can I purchase more data?"
Click Recognize Statement to get the Recognition Result. The Recommended Statement is the statement which is semantically related to more ontologies and can generally capture more statement structures with the same intent. To use the recommended statement, just tick the checkbox saying Use Recommended Statement.
6. Additional Query Statement to Recognize may also be used in case of multiple statements being able to trigger the subject.
7. Click Add
Build the Subject
Step 1: Data Purchase
Name the first Step "Data Purchase".
2. Click Add Component in the Components panel.
3. Click Parameter Bundle.
4. In the popup, enter a Parameter Bundle name as "Purchase" and Parameter names as "Data Plan", "Name", "Number". Set them as required.
5. Click Add.
6. To set up the Data Plan Parameter, select the Compound Value tab in the Component Settings panel.
7. Enter the Local Binding Key
as "data_plan".
8. Click Set up Entity Type.
9. In the popup, click on System(Extensible) tab.
10. Select the MSISDN
entity type.
11. Click Submit.
12. Enter Designator. Key Path.
13. Click Save.
14. Click Add Action in the Conversational panel.
15. Under Check for Parameter, click Check.
16. In the Action Settings panel, select the Combined tab.
17. Choose a webhook URL http://mock-webhook.mind.ai to use from the dropdown and enter URL Parameter (domain path and/or query string) as tutorial/mobile-data-list?code=200.
Webhook URL (Method: GET)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/mobile-data-list?code=200
Response Body
18. **** Select the GET
request method.
19. Select an error message display method as Template
and select an action as Terminate to take in case of HTTP 400. If Passthrough
is selected, the webhook response will be displayed without modification.
20. Enter an error message that will be displayed to the customer.
21. Enter Key and JSONPath pairings for Result Mapping.
KEY data_list
JSONPATH $.data-list
22. Enter the instruction.
24. Enter Prompt
"How much data would you like to purchase?", then click Save.
25. Select the Name Parameter in the Component panel.
26. In the Component Settings panel, stay with the Single Value tab.
27. For the Binding Key, select the Global tab and choose the customer_name
global binding key.
28. Click Set up Entity Type.
29. In the popup, select the System Entities tab.
30. Select the Any Entity entity type.
31. Click Submit.
32. Click Save.
33. Click Add Action in the Conversational panel.
34. Under Check for Parameter, click Check.
35. In the Action Settings
panel, stay in the Customer
tab.
36. In the Instruction to show before the prompt
, enter "Let me verify your name and your number."
37. Enter the Prompt
as "What is your name?"
38. Click Save.
39. Select the Number Parameter in the Component panel.
40. In the Component Settings panel, stay with the Single Value tab.
41. For the Binding Key, select the Global tab and choose the customer_number
global binding key.
42. Click Set up Entity Type.
43. In the popup, click the System(Extensible) tab.
44. Select the MSISDN entity type.
45. Click Submit.
46. Click Save.
47. Click Add Action in the Conversational panel.
48. Under Check for Parameter, click Check.
49. In the Action Settings panel, stay in the Customer tab.
50. Enter the Prompt
as "Thanks, {{customer_name}}. What is your number?"
51. Click Save.
52. Click Add Action in the Conversational panel.
53. Click Confirm
54. Select the Webhook tab.
55. Choose a webhook URL http://mock-webhook.mind.ai/
to use from the dropdown and enter URL Parameter (domain path and/or query string) as tutorial/validate-name-phone?code=200&out=valid
. It will return affirmation.
Webhook URL (Method: POST)
BASE URL http://mock-webhook.mind
.ai
URL PARAMETER tutorial/validate-name-phone?code=200&out=valid
****
Request Parameter
Response Body (out=valid)
Response Body (out=invalid)
56. Select the request method as POST
. For the POST
request, you can enter the Request Body if needed. Enter the Request Body
as stated below:
Request Body
57. Select an error message display method as Template
and select an action as Terminate
to take in case of HTTP 400. If Passthrough
is selected, the webhook response will be displayed without modification.
58. Enter an error message that will be displayed to the customer.
59. Enter a JSONPath for Expected Value Matching Path.
60. Enter a value for Expected Value.
61. Select an action as Terminate
to take in case of getting the opposing value. Enter the message "Sorry, I am terminating the session." to display to the customer.
62. Click Save.
63. Click Confirm under Completion of Parameter Bundle.
64. In the Action Settings panel, select the Combined
tab.
65. Choose a webhook URL http://mock-webhook.mind.ai
to use from the dropdown and enter URL Parameter (domain path and/or query string) as tutorial/mobile-data-detail?code=200
. It will return affirmation.
Webhook URL (Method: POST)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/mobile-data-detail?code=200
Response Body
66. Select the request method as POST. For the POST request, you can enter the Request Body if needed. Enter the Request Body.
Request Body
67. Select an error message display method as Template and select an action as Terminate to take in case of HTTP 400. If Passthrough is selected, the webhook response will be displayed without modification.
68. Enter an error message that will be displayed to the customer.
69. Enter a Key and JSONPath pairing for Result Mapping.
KEY data_amount
JSONPATH $.amount
70. Enter the prompt as "{{data_amount}} will be added to your bill for this month. Would you like to continue?".
71. Set the Expected Response as Affirmation
.
72. Select an action as Try again
to take on opposing response. Enter an error message to display to the customer.
73. Click Save.
Step 2: Response
Add another Step and name it "Response".
2. Click Add Component in the Components panel.
3. Click Condition.
4. Name the Condition "Confirmation".
5. Click Add.
6. Stay with the autofilled Query Term then tick off the Query Statement option.
7. Click Save.
8. Click Add Action in the Conversational panel.
9. Click Show response under Completion of Condition.
10. In the Action Settings panel, select the Webhook
tab.
11. Choose a webhook URL http://mock-webhook.mind.ai
to use from the dropdown and enter URL Parameter (domain path and/or query string) as tutorial/confirm-data-purchase?code=200
Webhook URL (Method: POST)
BASE URL http://mock-webhook.mind.ai http://mock-webhook.mind.ai
URL PARAMETER tutorial/confirm-data-purchase?code=200
Response Body
12. Select the request method as POST
. For the POST
request, you can enter the Request Body if needed. Enter the Request Body.
Request Body
13. **** Select an error message display method as Template
and select an action as Terminate
to take in case of HTTP 400. If Passthrough
is selected, the webhook response will be displayed without modification.
14. Enter an error message that will be displayed to the customer.
15. Keep the Mapping toggle on.
16. Enter Key and JSONPath pairings for Result Mapping.
Result Mapping Pair 1
KEY data_final
JSONPATH $.data
Result Mapping Pair 2
KEY remain
JSONPATH $.remain
17. Enter the template to show to the customer as a response.
18. Click Save.
19. Click Publish to publish the Subject.
20. To test the subject, click on the sandbox button on the right side of the screen and enter the query statement configured, in this case, I would like to purchase more data
.
\
Last updated