Alexa Knowledge Skills is now available using SMAPI

Ariana Tabatabaie Jul 13, 2021
Share:
Alexa Skills Kit Alexa for Business News
Blog_Header_Post_Img

In April 2021, we announced the general availability of Alexa Knowledge Skills in the U.S. for personal, Alexa for Business, and Alexa for Hospitality devices. Today, we are excited to announce that managing those skills just got easier.

Now, anyone can use Alexa’s Skill Management API (SMAPI) to manage Knowledge skills. SMAPI supports five actions related to Knowledge skills: creating Knowledge skills (e.g. for organizational charts, products, or projects), importing data, retrieving import status, retrieving template IDs, and enabling Knowledge skills on devices.

Before, you could only manage Knowledge skills in the Alexa Developer Console. To add data to your skill, you had to manually upload spreadsheets by clicking buttons in the interface. While this workflow worked in adding evergreen data, it prevented Knowledge skills from supporting use-cases requiring data that changed often, such as Menus, Events, or Inventory. With this release, you can now manage Knowledge skills and upload data programmatically outside of the Alexa Developer Console, expanding the range of use-cases Knowledge skills support.

How Organizations Plan to Use This

"We’re excited to bring no code, conversational AI capabilities to our customers by incorporating Alexa Knowledge Skills’ latest APIs within Aiva’s Voice OS," said Sumeet Bhatia, Founder and CEO of Aiva Health, the voice platform for hospitals and senior communities. "Senior living communities, in particular, push an ever-changing stream of information to their residents -- like daily activities and menu specials. Integrating the new Knowledge API enables Aiva to seamlessly make the updated content available for use via the voice interface on enterprise managed Alexa devices."

“By combining Knowledge Skill API request paths and Lambda functions, we are going to bring worldwide real-time information to anyone at our clients. No more opening a laptop, calling the warehouse, or calling someone in another department to check quantities. We have an application that will keep inventory, use a Lambda function to call the API request paths to update our Knowledge skill, and then Alexa will deliver this info to our client’s users. We intend to expand this functionality to cover anything we can keep in a spreadsheet.” - Marcus Blair at Omega Digital Consulting

Get Started

Let’s walk through an example using SMAPI to create a Knowledge skill, import data, get the status of that import, and enable the skill for testing.

Step 1. Generate an access token

  • When you use API operations for your knowledge skills, you must provide an access token in the header of your API requests. For details, see Get an access token for SMAPI.

Step 2. Create a Knowledge skill

  • The endpoint for Knowledge skill API requests is https://api.amazonalexa.com. To create a Knowledge skill, you will need to submit the following request: POST https://api.amazonalexa.com/v1/skills 
  • As with any Alexa skill, you must include a skill manifest in the body of this request. For details about fields specific to knowledge skills, see knowledge skill manifest. The following example shows a knowledge skill manifest.

Copied to clipboard
{
  "vendorId": "<your vendorId>",
  "manifest": {
    "publishingInformation": {
      "locales": {
        "en-US": {
          "name": "Sample Knowledge Skill",
          "description": "This skill is a sample knowledge skill."
        }
      },
      "distributionCountries": [
                "US"
      ]
    },
    "apis": {
      "knowledge": {
        "locales": {
          "en-US": {
            "answerAttribution": "Insert optional attribution phrase."
          }
        }
      }
    },
    "privacyAndCompliance": {
      "allowsPurchases": false,
      "isExportCompliant": true,
      "isChildDirected": false,
      "usesPersonalInfo": false
    }
  }
}

Step 3: Import to your Knowledge skill

  • To import to the knowledge skill you just created, you will need to submit the following request: POST https://api.amazonalexa.com/v1/skills/{skillId}/knowledge/imports
  • To understand how to format your data, see Knowledge Skill Templates. The following example shows a request body with data from the glossary template. Here is an example request body with data from the glossary template:

Copied to clipboard
{
  "contentType": "text/csv",
  "template": {
    "id": "f184839a-c0ff-46d7-84b9-ca557f92519f"
  },
  "importContent": "term,alternate_names,definition\nbar raiser,b.r.^br^,A Bar Raiser is an interviewer at Amazon."
}

  • A successful request returns "202 Success". The Location header contains a string you can use to track the import. To learn more about this request, see import data.

Step 4: Get the status of the import

  • To get the status of the import, you submit the following request: GET https://api.amazonalexa.com/v1/skills/{skillId}/knowledge/imports/{importId}. You use the import ID from the Location header of your import request in the previous step
  • In this example, a successful request returns "200 Success" and a response body like the following:

Copied to clipboard
{ 
  "knowledgeImport": {
    "errors": [],      
    "progress": 75,
    "status": "IN_PROGRESS"
  }
}

Step 5: Enable your Knowledge skill

  • To enable this knowledge skill for testing, you can use this request: PUT https://api.amazonalexa.com/v1/skills/{skillId}/stages/development/enablement
  • In this example, a successful request returns "204 No Content". To learn more about this request, see Enable a skill.
  • For details about how to enable knowledge skills for devices associated with an Alexa for Hospitality or Alexa for Residential accounts, see ‘Enable a skill’ in the Alexa for Hospitality documentation or the Alexa for Residential documentation.

Step 6: Test your knowledge skill

  • You can now test your skill by using an Alexa-enabled device, such as an Echo device, that is registered to the same Amazon account as the account in which you created your skill. In this example, you can ask your Echo device, "Alexa, what is a bar raiser?"

 

Subscribe