Rediger

Del via


Implement a custom scenario for smart assist bot

This topic provides information on how you can enable similar case suggestions in your smart assist bot.

Prerequisites

Important

Read the topic Build a smart assist bot for information on how to get started with building a custom smart assist bot.

Scenario: Similar case suggestion

This scenario enables you to suggest similar cases with open case action button. The customer service agent is presented with a list of similar cases as a recommendation. The agent clicks on the case that they finds most similar and relevant, and then goes to the case note and looks at the resolution in note. The agent suggests the same resolution to the customer over chat.

Generate intent to interpret the context of the conversation

It is necessary analyze the conversation and understand its context before recommending an action to the agent. Use Language Understanding (LUIS) to find the intent of the ongoing conversation. Here is an example on how you can create a LUIS app to find intent from a given text: Quickstart: Use prebuilt Home automation app.

You can create intents for each issue type or topic that you want to address for incoming requests from customers or the most common topics being discussed.

For the example scenario of similar case recommendations for ‘printer noise’ issue, create an intent with the same name and add 10-15 examples like ‘printer noise, loud noise from printer, printer making grinding noise, loud clicking noise, loud sound’ etc. The LUIS app then needs to be trained for this intent.

Author adaptive cards to display recommendations in the smart assist UI

Adaptive cards is an open-source standard that helps apps and services exchange rich snippets of native UI.

Custom actions for implementing custom functionalities

Custom actions can help you implement custom functionalities in your smart assist bot.

Given below are the steps for enabling the similar case scenario.

  1. Set up Similarity Rules

Setup similarity rule by following the steps 1 to 7 in mentioned here: Create a new similarity rule to view similar cases.

  1. Turn Relevance search ON

Turn On Relevance Search in the administrator section. More information: Enable a field for exact matching of similar cases.

  1. Similar cases API

Similar cases can be fetched using the GetSimilarRecords function. But before you execute the Web API query with this function, make sure that you have set up similarity rules. More information: Use advanced similarity rules to view similar case suggestions. Also, make sure to enable Relevance Search in the administrator section to ensure that similarity rules work in the expected manner. Also, in the Match Field section add a few criteria such as case title and case type.

Request

GET [Organization URI]/api/data/v9.1/GetSimilarRecords(Id=@Id,Filter=@Filter,ReturnFields=@ReturnFields)?@Id={"@odata.id":"incidents(<incident id>)"}&@Filter=null&@ReturnFields={"AllColumns":false,"Columns":["title","description"]}
Accept: application/json  
OData-MaxVersion: 4.0  
OData-Version: 4.0 

Replace the incident id in the Web API request above with the unique identifier of the case for which you want to find similar cases.

Response

{
    "@odata.context": "[Organization URI]/api/data/v9.1/$metadata#incidents",
    "value": [
        {
            "@odata.type": "#Microsoft.Dynamics.CRM.incident",
            "@odata.etag": "W/\"1571835\"",
            "title": "Product question re warranty",
            "modifiedon": "2019-03-03T12:58:25Z",
            "incidentid": "f69e62a8-90df-e311-9565-a45d36fc5fe8"
        },
        {
            "@odata.type": "#Microsoft.Dynamics.CRM.incident",
            "@odata.etag": "W/\"1572750\"",
            "title": "Shipment question re order",
            "modifiedon": "2019-03-03T12:58:27Z",
            "incidentid": "129f62a8-90df-e311-9565-a45d36fc5fe8"
        }
    ]
}

Calling custom actions using adaptive cards

You will have to create a web resource if you want to use embed a custom action within a suggestion. See the Power Apps topic on Create your own actions for information on how to build a custom action. See the topic Web resources in model-driven apps for information on how to create web resources. These web resources will have to be uploaded under the Active Conversation form. Given below are the supported custom actions.

OpenForm custom action

This custom action enables you to open any entity record.

{
              "type": "Action.Submit",
              "title": "Open",
              "data": {
                             "CustomAction": "OpenForm",
                             "CustomParameters": {
                                           "entityName": "incident",
                                           "entityId": "c3356c37-bba6-4067-b1a1-8c66e1c203a1",
                                           "data": {}
                             }
              }
}

SendKB custom action

This custom action enables you to send a knowledge base article.

Note

The CustomAction key should contain SendKB and kbLink key should contain the link of the KB article. You cannot have another custom action with the same name as SendKB.

{

          "type": "Action.Submit",
          "title": "Send",
          "data": {
                          "CustomAction": "SendKB",
                          "CustomParameters": {
                          "kbLink": "https://ocddemoebc.powerappsportals.com/knowledgebase/article/KA-01011/en-us"
                  }
          }
}

You can use the client-side APIs to open knowledge base articles. See Client API reference for model driven apps for more information.

Build a smart assist bot
Sample code: Smart Assist for Bots
Smart assist for agents