703.868.6393 contact@focalcxm.com

At Focal, we are excited about Alexa. We are confident that voice will truly disrupt experiences across the CRM spectrum of Marketing, Sales and Service. With that fervor, we recently did a small experiment to see how Alexa can improve our support experience. So, we started off with a simple goal to connect to our support portal and have Alexa read out the total number of open tickets. Before we dig in, I just want to highlight the key components of our solution.

Amazon Echo? Amazon Echo is a wireless speaker and microphone device that allows users to interact with online services using voice. Alexa is the name of the speech service that powers Echo.

Alexa SDK: “Alexa Skills Kit” SDK. The Skills Kit runs in the cloud, handling the voice interfaces such as speech-to-text recognition and text-to-speech encoding.

Amazon Lambda: Have you heard of serverless computing? Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume – there is no charge when your code is not running. To know more, check out Lamda’s website (https://aws.amazon.com/lambda/)

Freshdesk: This is our support portal where we track all our customer tickets (https://freshdesk.com/)

The overall flow is below!

  • To begin with, a support agent can invoke an app (e.g FocalSupport) by saying  Alexa, talk to FocalSuport. With “Alexa”  Echo knows that it is being addressed and startes listening for next steps.
  • Then the agent can identify the Skill that the user wishes to interact with. For example “Alexa, “How many tickets are in my fresh desk?” The question “How many tickets in my fresh desk” identifies the skill that the user wants to know the open tickets in your desk
    • “How many tickets in my fresh desk” is the invocation name that we need to provide while creating a custom skill.
      • Echo will send the request to the Alexa Service Platform, which will handle the speech recognition and will turn the speech into token and identify the intent.
      • What is an intent? A user’s intention to perform a specific task. Example: In the above example we created an intent called GetFreshDeskCount, the objective of which is to bring the Fresh Desk open tickets and calculating the total count.
  • The intent will send as a JSON encoded format to AWS from where we can invoke an AWS Lambda which executes the expected function and returns the response from Fresdehsk.

CONFIGURING ALEXA CUSTOM SKILL

To configure a custom skill, you log-in to developer.amazon.com with your AWS account details.  From here, you can select the “Alexa” tab, then “Get Started” from the “Alexa Skills Kit” section.

Click on  “Add a New Skill” to setup a custom skill.

Name: The name of the skill in the skills page.

Invocation Name: Where this will be a referenced by the function.

Configuring the Intent Schema:

In the Alexa architecture, you can assume that intents are distinct Lambda functions that a skill can perform. note that the intent is expressed in JSON. Intents can also take as arguments which are known as slots.

For the above example skill, I had just one intent and hance one Lambda function.

GetFreshDeskCount:  Will get the count of the open tickets in the fresh desk.

AMAZON.HelpIntent: Provide the user with some help text

AMAZON.StopIntent: Let the user stop an operation

AMAZON.CancelIntent: Let the user cancel an operation

Now the complete intent should look like this

{

    “intents”: [

        {

            “intent”: “GetFreshDeskCount”

        },

        {

            “intent”: “AMAZON.HelpIntent”

        },

        {

            “intent”: “AMAZON.StopIntent”

        },

        {

            “intent”: “AMAZON.CancelIntent”

        }

    ]

}

There is an intent schema section were you need to paste the JSON.

Configuring Sample Utterances

Sample Utterances” are where we define the phrases that Alexa needs to hear in order to invoke each of your Custom Skill’s Intents. This is done using a simple text list of the format below.

<Intent Name> <Phrase>

GetFreshDeskCount what is my fresh desk open tickets

GetFreshDeskCount my open tickets

GetFreshDeskCount tell my open tickets

Coding Custom Skill:  In my example, I decided to use AWS Lambda to implement my execution code. If you want to leverage Lambda as well, then you can 

def lambda_handler(event, context):

                Intent Code….

As we know the communication between the Alexa platform and our lambda as JSON, the code looks like this:

Lambda Request:

{

  “session”: {

    “sessionId”: “SessionId.b0b7596f-f27c-4213-8838-c45ef35bc7ca”,

    “application”: {

      “applicationId”: “amzn1.ask.skill.b3b1b410-6f1b-4dce-a0f2-146983164caa”

    },

    “attributes”: {},

    “user”: {

      “userId”: “kjhblkhb;kjblkbljhbjbjhb”

    },

    “new”: true

  },

  “request”: {

    “type”: “LaunchRequest”,

    “requestId”: “EdwRequestId.koejd-keokw-leidmei”,

    “locale”: “en-US”,

    “timestamp”: “2017-05-08T17:12:12Z”

  },

  “version”: “1.0”

}

Lambda Response:

{

  “version”: “1.0”,

  “response”: {

    “outputSpeech”: {

      “type”: “PlainText”,

      “text”: “Your have 19 open tickets in fresh desk”

    },

    “card”: {

      “content”: “Your have 19 open tickets in fresh desk”,

      “title”: “”,

      “type”: “Simple”

    },

    “reprompt”: {

      “outputSpeech”: {

        “type”: “PlainText”,

        “text”: “”

      }

    },

    “shouldEndSession”: true

  },

  “sessionAttributes”: {}

}

The generation of request JSON will be done by our server side python code, just you need to map the intent with appropriate method.

Hope you find this useful. We will post more examples as we get to know Alexa better!