Share agent assistance suggestions using text messages during phone calls

Agents can click each suggestion to go into the detail view of the suggestion and can click the link in the suggestion to open the associated KM article.

If the shareSuggestionsExternally setting is enabled, agent can see a share using the text message button in the detail view of the suggestion. If an SR is associated in the IVR data of the phone call, an agent can see a share using email button in the detail view of the suggestion.

It's assumed you've completed the prerequisites and added the code for sharing suggestions externally.

Once the call is in progress, you'll see agent assistance suggestions in the Fusion application. You can click a suggestion to go into the detail view of the suggestion where there will be a Share via text message icon there.

The following flow diagram shows the sequence of operations performed once the agent clicks on the Share via text message button in the snippet suggestion:

A graphic of the onSuggestionShared event.

  1. If the shareSuggestionsExternally parameter is set as true the agent can see a Share via text message button in the drill-down view of the snippet. The agent clicks the button to send the suggestion as text messages to the customer.
  2. The onToolbarInteractionCommand event listener in the media toolbar application is executed with the command of onSuggestionShared. The event payload contains suggestion information such as externalUrl, suggestion text, and so on. From this eventlistener, for the onSuggestionShared command, you need to call your supplier or SMS provider API to send the text message.
  3. Your SMS supplier sends the SMS and responds whether the status is success or failure. If the SMS share status is success, a resolved promise is returned from the onToolbarInteractionCommand event listener with commandObject.result='success', and if the SMS share status is failure, a resolved promise is returned from the onToolbarInteractionCommand event listener with commandObject.result='failure'.

    If the commandObject.result is set as success, the following message: The article titled {ARTICLETITLE} has been shared with the customer through SMS is shown in the call transcript as a message to the agent.

    If the commandObject.result is set as failure, the following message: Failed to share the article titled {ARTICLETITLE} with the customer through SMS is shown in the call transcript as a message to the agent.

How to send the suggestion as a SMS through your CTI supplier

  1. In the ICtiVendorHandler.ts file, add the shareSuggestionExternally declaration for the sendTextMessage function:
    export interface ICtiVendorHandler {
        //...
        sendTextMessage(suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function): Promise<void>;
        //...
    }
  2. Update subscribeToToolbarInteractionCommandsFromFusion in the fusionHandler.ts file with shareSuggestionExternally:
    public static subscribeToToolbarInteractionCommandsFromFusion(callback: Function): void {
            const request: IMcaEventRequest = FusionHandler.frameworkProvider.requestHelper.createSubscriptionRequest('onToolbarInteractionCommand') as IMcaEventRequest;
            FusionHandler.phoneContext.subscribe(request, (eventResponse: IEventResponse) => {
                return new Promise((resolve, reject) => {
                    const eventResponseDetails: IMcaOnToolbarInteractionCommandDataResponse = (eventResponse as IMcaOnToolbarInteractionCommandEventResponse).getResponseData();
                    callback(eventResponseDetails.getCommand(), eventResponseDetails.getData(), resolve);
                })
     
            });
        }
  3. Update the subscribeToToolbarInteractionCommandsFromFusion function call from the makeAgentAvailable function in the integrationEventsHandler.ts file to handle the new parameters as shown in the following example:
    public async makeAgentAvailable(): Promise<void> {
        try {
            //...
                FusionHandler.subscribeToToolbarInteractionCommandsFromFusion((command: string, suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function) => { this.listenToToolbarInteractionCommandsFromFusion(command, suggestionData, resolveRef); });
            //...
        } catch (err) {
            //...
        }
    }
  4. Update the listenToToolbarInteractionCommandsFromFusion function signature to handle the new parameters and add a case for the onSuggestionShared command as shown example:
    public listenToToolbarInteractionCommandsFromFusion(command: string, suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function): void {
        switch (command) {
            //...
            case "onSuggestionShared":
                    this.ctiAppViewModel.shareSuggestionExternally(suggestionData, resolveRef);
            //...
        }
    }
  5. Define the functionshareSuggestionExternally in the appController.ts file as shown in the following example:
    public shareSuggestionExternally: (suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function) => void = (suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function): void => {
        this.integrationActionHandler.shareSuggestionExternally(suggestionData, resolveRef).then(() => {
          console.log("Requested to send message")
        }).catch(() => {
          console.log("Error: Unable to accept the call.")
        });
      }
  6. Define the function shareSuggestionExternally in the integrationActionHandler.ts file as shown in the following example:
    public async shareSuggestionExternally(suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function): Promise<void> {
            await this.vendor.sendTextMessage(suggestionData, resolveRef);
        }
  7. Implement the logic to send message using your CTI supplier in the vendorHandler.ts file as shown in the following example:
    export class VendorHandler implements ICtiVendorHandler {
    //...
    public async sendTextMessage(suggestionData: IMcaOnToolbarInteractionCommandData, resolveRef: Function): Promise<void> {
            // TODO: call the vendor specific api to send text message
            // if(SMS SHARE STATUS FROM API RESPONSE IS 200 OR SUCCESS)
                suggestionData.result = 'success';
            //  else
                suggestionData.result = 'failure';
            resolveRef(suggestionData);
        }
    //...
    }

Verify your progress

Once you complete these steps, use OJET serve to start you application and sign in to your Fusion application. Open the media toolbar and make your agent available for calls by clicking on the agent availability button. You can accept the call from your media toolbar application or from your Fusion application. Once the conversation is started, you can see the real-time transcripts are getting rendered in the Fusion engagement panel. You'll also see agent assistance suggestions are shown based on the suggestions. When you go to the drill down view of a particular suggestion, you'll see a Share via text message button. And when you click the button, the suggestion will be shared as a text message to the customer.