Case 2. Payment History
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 an entity type. Add a regex entity type "MSISDN" in Knowledge.
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
Info Search
tab.Enter a Subject name.
Enter Query Statement which is the expected customer query as "I’d like to check my payment history."
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 added but not required. This is used in case of multiple intents being expected to trigger this subject.
7. Click Add.
Build the Subject
Click Add Component in the Components panel.
Click Selection Class.
3. Enter a Selection Class name as "Product Quantity" and Selection names as "One", "Multiple".
4. Click Add.
5. In the Component Settings panel, enter a Selection Term for the One
Selection as "single", then tick off the Query Statement.
6. Click Save.
7. Go to the other Selection Multiple
.
8. In the Component Settings panel, enter a Selection Term for the Multiple
Selection as "multiple", then tick off the Query Statement. Entities can also be used as a selection term, depending on which is necessary.
9. Click Save.
10. Click Add Action in the Conversational panel.
11. Under Check for Selection Class, click Check.
12. Select the Webhook
tab.
13. 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-phone-list?code=200&out=m
. It will return a "multiple" Selection Term for the Selection Class.
Webhook URL (Method: GET)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/mobile-phone-list?code=200&out=m
Response Body
14. Select the GET
request method.
15. 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.
16. Enter an error message that will be displayed to the customer.
17. Enter the Term Matching JSONPath.
JSONPATH
$.mobile-phone-number-count
18. Click Save.
19. Click Add Child Component under the Multiple
Selection in the Components panel.
20. Click Parameter Bundle.
21. In the popup, enter a Parameter Bundle name as "Show Product List" and Parameter names as "Mobile ID", "Month". Set them as required.
22. Click Add.
23. To set up the Mobile ID Parameter, select the Compound Value tab in the Component Settings panel.
24. Enter the local binding key as "mobile_id".
25. Click Set up Entity Type.
26. In the popup, click the System (Extensible) tab.
27. Select the MSISDN entity type.
28. Click Submit.
29. Enter Designator.Key Path.
KEYPATH $.mobile-phone-numbers.mobile-id
30. Click Save.
31. Click Add Action in the Conversation panel.
32. Under Check for Parameter, click Check.
33. Select the Combined
tab.
34. 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-phone-list?code=200&out=m.
Webhook URL (Method: GET)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/mobile-phone-list?code=200&out=m
Response Body
35. Select the GET
request method.
36. Select an error message display method as Template
and select an action as Try again
to take in case of HTTP 400. If Passthrough
is selected, the webhook response will be displayed without modification.
37. Enter an error message that will be displayed to the customer.
38. Under Keys to Reset, enter "mobile_id".
39. Enter Key and JSONPath pairings for Result Mapping.
Result Mapping Pair 1
KEYmobile_phone_number_count
JSONPATH$.mobile-phone-number-count
Result Mapping Pair 2
KEY mobile_phone_numbers
JSONPATH $.mobile-phone-numbers
40. Enter the prompt.
41. Click Save.
42. Select the "Month" Parameter in the Components panel.
43. In the Component Settings panel, stay with the Single Value
tab.
44. Enter the local binding key as "month".
45. Click Set up Entity Type.
46. In the popup, select the System
tab.
47. Select Any Entity
.
48. Click Submit.
49. Click Save.
50. Click Add Action in the Conversation panel.
51. Under Check for Parameter, click Check.
52. In the Action Settings panel, stay in the Customer
tab.
53. Enter the prompt as "For which month?"
54. Click Save.
55. Click Show response under Completion of Parameter Bundle on the bottom of the Conversation panel.
56. Select the Webhook
tab.
57. 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/payment-history?code=200
Webhook URL (Method: POST)
BASE URL http://mock-webhook.mind.ai
``URL PARAMETER tutorial/payment-history?code=200
Response Body
58. **** Select the request method as POST
. For the POST
request, you can enter the Request Body if needed. Enter the Request Body.\
Request Body (Accepted month format: January to December)
59. 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.
60. Enter an error message that will be displayed to the customer.
61. Keep the Mapping toggle on.
62. Enter Key and JSONPath pairings for Result Mapping.
KEY payment_history
``JSONPATH $.payment-history
63. Enter the template to show to the customer as a response.
64. Click Save.
65. Click Publish to publish the Subject.
66. 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'd like to check the payment history
.
Last updated