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

  1. Click Add Subject on the Scope details page.

  2. Select the Query Freestyle tab.

  3. Enter a Subject name.

  4. Enter Query Statement which is the expected customer query as "I want to change the mobile plan."

  5. 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

  1. Name the first Step "Account Quantity".\

  2. Click Add Component in the Components panel.

  3. Click Selection Class.\

  4. Enter a Selection Class name as "Account Quantity" and Selection names as "One", "Multiple".

  5. Click Add.\

  6. 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.

  7. Toggle the Query Statement off.

  8. Click Save.

  9. Go to the other Selection Multiple.

  10. In the Component Settings panel, enter a Selection Term for the Selection Multiple as "multiple".

  11. Toggle the Query Statement off.

  12. Click Save.

  13. Click Add Action in the Conversational panel.

  14. Under Check for Selection Class, click Check.

  15. Select the Webhook tab.\

  16. 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=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" } ] }

  17. Select the GET request method.

  18. 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.

  19. Enter an error message that will be displayed to the customer. Sorry, I am terminating the session.

  20. Enter the Term Matching JSONPath. $.mobile-phone-number-count

  21. Click Save.\

  22. Click Show response under Completion of Selection Class.

  23. Select the Webhook tab.

  24. 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/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)" } } }

  25. Select the request method as POST. For the POST request, you can enter the Request Body if needed. Enter the Request Body.

    Request Body

    { "mobile-id": "101002000" }

  26. 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.

  27. Enter an error message that will be displayed to the customer. Sorry, I am terminating the session.

  28. Keep the Mapping toggle on.

  29. 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

  30. Enter the template to show to the customer as a response. Your current plan is as below. {{current_plan}}

  31. Click Save.\

Step 2: Change Plan

  1. Add another Step and name it "Change Plan".\

  2. Click Add Component in the Components panel.

  3. Click Selection Class.

  4. Enter a Selection Class name as "Change Plan" and Selection names as "Yes", "No".\

  5. Click Add.

  6. In the Component Settings panel, enter a Selection Term for the Yes Selection as "Yes".

  7. Enter Query Statement which is the expected customer query as "Yes”.

  8. Click Recognize Statement to get the Recognition Result.

  9. Click Save.

  10. Go to the other Selection "No".

  11. In the Component Settings panel, enter a Selection Term for the No Selection as "No".

  12. Enter Query Statement which is the expected customer query as "No”.

  13. Click Recognize Statement to get the Recognition Result.

  14. Turn on the Terminate toggle to end the session in the No Selection.

  15. Click Save.\

  16. Click Add Action in the Conversational panel.

  17. Under Check for Selection Class, click Check.

  18. In the action settings panel, stay in the Customer tab.

  19. Enter the prompt to the customer as "Do you want to change the plan?".

  20. Click Save.

  21. In the Components panel, select the Yes Selection.

  22. Click Add Child Component in the Components panel.

  23. Click Parameter Bundle.

  24. 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.

KEY PATH $.plan-list.plan-id

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

  1. Add another Step and name it "Check Identity".

  2. Click Add Component in the Components panel.

  3. Click Parameter Bundle.

  4. In the popup, enter a Parameter Bundle name as "Verify Customer" and Parameter names as "Name", "Number". Set them as required.

  5. Click Add.

  6. To set up the Name Parameter, stay in the Single Value tab in the Component Settings panel.

  7. For the Binding Key, select the Global tab and choose the customer_name global binding key.

  8. Click Set up Entity Type.

  9. In the popup, select the System Entities tab.

  10. Select the Any Entity entity type.

  11. Click Submit.

  12. Click Save.

  13. Click Add Action in the Conversational panel.

  14. Under Check for Parameter, click Check.

  15. In the Action Settings panel, stay in the Customer tab.

  16. Enter the instruction as "Let me verify your name and your number."

  17. Enter the prompt as "What is your name?"

  18. Click Save.

  19. Select the Number Parameter in the Component panel.

  20. In the Component Settings panel, stay with the Single Value tab.

  21. For the Binding Key, select the Global tab and choose the customer_number global binding key.

  22. Click Set up Entity Type.

  23. In the popup, click the System(Extensible) tab.

  24. Select the MSISDN entity type.

  25. Click Submit.

  26. Click Save.

  27. Click Add Action in the Conversation panel.

  28. Under Check for Parameter, click Check.

  29. In the Action Settings panel, stay in the Customer tab.

  30. Enter the prompt as "Thanks, {{customer_name}}. What is your number?"

  31. Click Save.

  32. Click Add Action in the Conversational panel.

  33. Click Confirm

  34. In the Action Settings panel, stay in the Customer tab.

  35. Enter the prompt as "Is {{customer_number}} correct?".

  36. Set the Expected Response as Affirmation.

  37. Select an action as Try again to take in case of getting the opposing response. Enter an error message to display to the customer.

  38. Under Keys to Reset, enter "customer_number".

  39. Click Save.

  40. Click Show response under Completion of Parameter Bundle.

  41. Stay in the Local tab.

  42. Enter response as "Thanks for the confirmation."

  43. Click Save.

Step 4: Confirmation

  1. Add another Step and name it "Confirmation".

  2. Click Add Component in the Components panel.

  3. Click Condition.

  4. Name the Condition "New Plan".

  5. Click Add.

  6. 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.

  7. Toggle the Query Statement off.

  8. Click Save.

  9. Click Add Action in the Conversational panel.

  10. Click Show response under Completion of Condition.

  11. Select the Webhook tab.

  12. 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/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)" } }

  13. Select the request method as POST. For the POST request, you can enter the Request Body if needed. Enter the Request Body.\

    Request Body

    { "current-plan-id": "21000001", "new-plan-id": "10000002" } ``

  14. 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.

  15. Enter an error message that will be displayed to the customer. Sorry, I am terminating the session.

  16. Keep the Mapping toggle on.

  17. 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

  18. 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}}.

  19. Click Save.

Step 5: Termination

  1. Add another Step and name it "Termination".

  2. Click Add Component in the Components panel.

  3. Click Condition.

  4. Name the Condition "Termination".

  5. Click Add.

  6. In the Component Settings panel, enter the Query Term as "Termination".

  7. Toggle the Query Statement off.

  8. Click Save.

  9. Click Add Action in the Conversational panel.

  10. Click Show response under Completion of Condition.

  11. In the Action Settings panel, stay in the Local tab.

  12. Enter response as "Thanks for being a loyal customer."

  13. Toggle on the terminate button in the action settings.

  14. Click Save.

  15. 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