Case 2. Change Mobile Plan
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 escalation setup. Add an escalation URL to your escalation settings.
This tutorial requires "customer_name", "customer_number" global keys in the Scope.
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])?
``DESCRIPTION10 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 "I want to change the mobile plan."
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: Account Quantity
Name the first Step "Account Quantity".\
Click Add Component in the Components panel.
Click Selection Class.\
Enter a Selection Class name as "Account Quantity" and Selection names as "One", "Multiple".
Click Add.\
In the Component Settings panel, enter a Selection Term for the Selection One as "single". Entities may also be used as a Selection Term, whichever is necessary.
Toggle the Query Statement off.
Click Save.
Go to the other Selection
Multiple
.In the Component Settings panel, enter a Selection Term for the Selection
Multiple
as "multiple".Toggle the Query Statement off.
Click Save.
Click Add Action in the Conversational panel.
Under Check for Selection Class, click Check.
Select the
Webhook
tab.\Choose a webhook URL
http://mock-webhook.mind.ai
to use from the dropdown and enter URL Parameter (domain path and/or query string) astutorial/mobile-phone-list?code=200&out=s
. It will return a "single" 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=s
``Response Body\
{
"mobile-phone-number-count": "single",
"mobile-phone-numbers": [
{
"name": "Your 5G Data",
"mobile-id": "101002000"
}
]
}
Select the
GET
request method.Select an error message display method as
Template
and select an action asTerminate
to take in case of HTTP 400. IfPassthrough
is selected, the webhook response will be displayed without modification.Enter an error message that will be displayed to the customer.
Sorry, I am terminating the session.
Enter the Term Matching JSONPath.
$.mobile-phone-number-count
Click Save.\
Click Show response under Completion of Selection Class.
Select the
Webhook
tab.Choose a webhook URL
http://mock-webhook.mind.ai
to use from the dropdown and enter URL Parameter (domain path and/or query string) astutorial/current-plan?code=200
``Webhook URL (Method: POST)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/current-plan?code=200
``Response Body\
{
"currrent-plan": {
"current-package": "5G data plan\\n$40\\n80GB limited\\nSpeed will be reduced when exceeded maximum usage (80GB)",
"mobile-id": "101002000",
"plan-id": "21000001",
"current-package-structure": {
"name": "5G data plan",
"amount": "$40",
"data": "80GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (80GB)"
}
}
}
Select the request method as
POST
. For thePOST
request, you can enter the Request Body if needed. Enter the Request Body.Request Body
{
"mobile-id": "101002000"
}
Select an error message display method as
Template
and select an action asTerminate
to take in case of HTTP 400. IfPassthrough
is selected, the webhook response will be displayed without modification.Enter an error message that will be displayed to the customer.
Sorry, I am terminating the session.
Keep the Mapping toggle on.
Enter Key and JSONPath pairings for Result Mapping.\
Result Mapping Pair 1
KEY current_plan
JSONPATH $.current-plan.current-package
\Result Mapping Pair 2
KEY current_plan_id
JSONPATH $.current-plan.plan-id
Enter the template to show to the customer as a response.
Your current plan is as below.
{{current_plan}}
Click Save.\
Step 2: Change Plan
Add another Step and name it "Change Plan".\
Click Add Component in the Components panel.
Click Selection Class.
Enter a Selection Class name as "Change Plan" and Selection names as "Yes", "No".\
Click Add.
In the Component Settings panel, enter a Selection Term for the
Yes
Selection as "Yes".Enter Query Statement which is the expected customer query as "Yes”.
Click Recognize Statement to get the Recognition Result.
Click Save.
Go to the other Selection "No".
In the Component Settings panel, enter a Selection Term for the
No
Selection as "No".Enter Query Statement which is the expected customer query as "No”.
Click Recognize Statement to get the Recognition Result.
Turn on the Terminate toggle to end the session in the
No
Selection.Click Save.\
Click Add Action in the Conversational panel.
Under Check for Selection Class, click Check.
In the action settings panel, stay in the
Customer
tab.Enter the prompt to the customer as "Do you want to change the plan?".
Click Save.
In the Components panel, select the
Yes
Selection.Click Add Child Component in the Components panel.
Click Parameter Bundle.
In the popup, enter a Parameter Bundle name as "Show Plan List" and Parameter names as "Mobile Plan". Set it as required.
25. Click Add.
26. To set up the Mobile Plan
Parameter, stay in the Compound Value
tab in the Component Settings panel.
27. Enter the local binding key as "mobile_plan".
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. Enter Designator. Key Path.
33. Click Save.
34. Click Add Action in the Conversational panel.
35. Click Check under Check for Parameter.
36. Select the Combined
tab.
37. 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-plan-list?code=200.
``
Webhook URL (Method: GET)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/mobile-plan-list?code=200
``
Response Body\
{
"plan-list": [
{
"plan-id": "10000002",
"name": "4G+ data 25 plan",
"amount": "$22",
"data": "25GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (25GB)",
"description": "4G+ data 25 plan\n$22\n25GB limited\nSpeed will be reduced when exceeded maximum usage (25GB)"
},
{
"plan-id": "11000003",
"name": "4G+ data 35 plan",
"amount": "$28",
"data": "35GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (35GB)",
"description": "4G+ data 35 plan\n$28\n35GB limited\nSpeed will be reduced when exceeded maximum usage (35GB)"
},
{
"plan-id": "12000004",
"name": "4G+ data 60 plan",
"amount": "$35",
"data": "60GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (60GB)",
"description": "4G+ data 60 plan\n$35\n60GB limited\nSpeed will be reduced when exceeded maximum usage (60GB)"
},
{
"plan-id": "13000005",
"name": "5G data 180 plan",
"amount": "$48",
"data": "180GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (180GB)",
"description": "5G data 180 plan\n$48\n180GB limited\nSpeed will be reduced when exceeded maximum usage (180GB)"
},
{
"plan-id": "14000006",
"name": "5G+ data 220 plan",
"amount": "$50",
"data": "220GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (220GB)",
"description": "5G+ data 220 plan\n$50\n220GB limited\nSpeed will be reduced when exceeded maximum usage (220GB)"
}
]
}
38. Select the GET
request method.
39. 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.
40. Enter an error message that will be displayed to the customer.
Please try again.
41. Under Keys to Reset, enter "mobile_plan".
42. Enter a Key and JSONPath pairing for Result Mapping.
KEY plan_list
JSONPATH $.plan-list
43. Enter the instruction.
These are the mobile plans.
``
{{#plan_list}}
{{plan-id}}: ({{name}})
{{amount}}: {{data}}
{{comment}}
---------------------------------
{{/plan_list}}
44. Enter the prompt as "Which plan would you like to change it to?".
45. Click Save.
Step 3: Check Identity
Add another Step and name it "Check Identity".
Click Add Component in the Components panel.
Click Parameter Bundle.
In the popup, enter a Parameter Bundle name as "Verify Customer" and Parameter names as "Name", "Number". Set them as required.
Click Add.
To set up the
Name
Parameter, stay in theSingle Value
tab in the Component Settings panel.For the Binding Key, select the
Global
tab and choose thecustomer_name
global binding key.Click Set up Entity Type.
In the popup, select the
System Entities
tab.Select the
Any Entity
entity type.Click Submit.
Click Save.
Click Add Action in the Conversational panel.
Under Check for Parameter, click Check.
In the Action Settings panel, stay in the
Customer
tab.Enter the instruction as "Let me verify your name and your number."
Enter the prompt as "What is your name?"
Click Save.
Select the
Number
Parameter in the Component panel.In the Component Settings panel, stay with the
Single Value
tab.For the Binding Key, select the
Global
tab and choose thecustomer_number
global binding key.Click Set up Entity Type.
In the popup, click the
System(Extensible)
tab.Select the
MSISDN
entity type.Click Submit.
Click Save.
Click Add Action in the Conversation panel.
Under Check for Parameter, click Check.
In the Action Settings panel, stay in the
Customer
tab.Enter the prompt as "Thanks, {{customer_name}}. What is your number?"
Click Save.
Click Add Action in the Conversational panel.
Click
Confirm
In the Action Settings panel, stay in the
Customer
tab.Enter the prompt as "Is {{customer_number}} correct?".
Set the Expected Response as
Affirmation
.Select an action as
Try again
to take in case of getting the opposing response. Enter an error message to display to the customer.Under Keys to Reset, enter "customer_number".
Click Save.
Click Show response under Completion of Parameter Bundle.
Stay in the
Local
tab.Enter response as "Thanks for the confirmation."
Click Save.
Step 4: Confirmation
Add another Step and name it "Confirmation".
Click Add Component in the Components panel.
Click Condition.
Name the Condition "New Plan".
Click Add.
In the Component Settings panel, enter a Query Term as "New Plan". Entities can also be used as Query Term, this depends on which is best for the scenario you're creating.
Toggle the Query Statement off.
Click Save.
Click Add Action in the Conversational panel.
Click Show response under Completion of Condition.
Select the
Webhook
tab.Choose a webhook URL
http://mock-webhook.mind.ai
to use from the dropdown and enter URL Parameter (domain path and/or query string) astutorial/plan-changed?code=200.
``Webbhook URL (Method: POST)
BASE URL http://mock-webhook.mind.ai
URL PARAMETER tutorial/plan-changed?code=200
``Response Body
{
"current-plan": {
"current-package": "5G data plan\n$40\n80GB limited\nSpeed will be reduced when exceeded maximum usage (80GB)",
"mobile-id": "101002000",
"plan-id": "21000001",
"current-package-structure": {
"name": "5G data plan",
"amount": "$40",
"data": "80GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (80GB)"
}
},
"new-plan": {
"plan-id": "10000002",
"name": "4G+ data 25 plan",
"amount": "$22",
"data": "25GB limited",
"comment": "Speed will be reduced when exceeded maximum usage (25GB)",
"description": "4G+ data 25 plan\n$22\n25GB limited\nSpeed will be reduced when exceeded maximum usage (25GB)"
}
}
Select the request method as
POST
. For thePOST
request, you can enter the Request Body if needed. Enter the Request Body.\Request Body
{
"current-plan-id": "21000001",
"new-plan-id": "10000002"
}
``Select an error message display method as
Template
and select an action asTerminate
to take in case of HTTP 400. IfPassthrough
is selected, the webhook response will be displayed without modification.Enter an error message that will be displayed to the customer.
Sorry, I am terminating the session.
Keep the Mapping toggle on.
Enter Key and JSONPath pairings for Result Mapping. \
Result Mapping Pair 1
KEY previous_plan_name
JSONPATH $.current-plan.current-package-structure.name
\Result Mapping Pair 2
KEY new_plan_name
JSONPATH $.new-plan.name
\Result Mapping Pair 3
KEY new_plan_description
JSONPATH $.new-plan.description
Enter the template to show to the customer as a response.
Your plan has changed from {{previous_plan_name}} to {{new_plan_name}}
{{new_plan_description}}.
Click Save.
Step 5: Termination
Add another Step and name it "Termination".
Click Add Component in the Components panel.
Click Condition.
Name the Condition "Termination".
Click Add.
In the Component Settings panel, enter the Query Term as "Termination".
Toggle the Query Statement off.
Click Save.
Click Add Action in the Conversational panel.
Click Show response under Completion of Condition.
In the Action Settings panel, stay in the
Local
tab.Enter response as "Thanks for being a loyal customer."
Toggle on the terminate button in the action settings.
Click Save.
Click Publish to publish the Subject.
17. 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 want to change the mobile plan
.
Last updated