アクセスいただきありがとうございます。こちらのページは現在英語のみのご用意となっております。順次日本語化を進めてまいりますので、ご理解のほどよろしくお願いいたします。

Steps to Create a Video Skill

You create a video skill in the Amazon developer console. Once you’ve created the skill, you provide skill information, configuration and skill code hosted as an AWS Lambda function (an Amazon Web Services offering) that handles requests from the Video Skill API and communicates with a device or video streaming service. To enable this communication, the cloud or service should support the OAuth 2.0 authorization code grant type. You will need information about the authentication endpoint, client ID and secret to complete the video skill registration.

This topic provides the steps for creating a skill in the developer portal, creating the AWS Lambda function, configuring and testing your skill, and submitting it for certification.

Register as an Amazon Developer and Create a Skill

To configure a new video skill, you need an account on the Amazon Developer Portal. If you don’t already have an account, go to https://developer.amazon.com/alexa/console/ask and create an account. Registering is free. Once you’ve registered:

  1. Open the Amazon go to the Developer Console and login.
  2. Click the Create Skill button.
  3. Enter the Skill name . Note that your skill’s name must not indicate that its functionality is limited. For example, you should not use "basic", "reduced" or "simple" in the name of your skill.
  4. Select the Default language.
  5. Under the Choose a model to add to your skill page, select Video, which is a pre-built model.
  6. Click Create Skill.
  7. Copy the Your Skill ID to the clipboard. The ID will be in a format similar to the following: amzn1.ask.skill.1a2b55555-c325-1234-d56e-1f234d5e6a78

For more information on how to use the developer console, see Manage Skills in the Developer Console.

Next, you will create a Lambda function so that you can configure the Video Skill Service endpoint.

Create a Lambda Function

You will need an AWS account and some basic knowledge of AWS.

The code for your video skill is hosted as a Lambda function on AWS. AWS Lambda is a service that lets you run code in the cloud without managing servers. The Video Skill API sends your skill requests. Your code parses the request, takes any necessary actions, and responds.

You need an AWS Identity and Access Management (IAM) Role with the AWSLambdaBasicExecutionRole policy attached. If you don't have this, complete the steps for To create an IAM role before completing the steps to create a Lambda function. If you already have a role with this policy, skip to To create a Lambda function.

To create an IAM role

Navigate to the Identity and Access Management (IAM) console.

  • Choose Roles and click Create a new role.
  • Select AWS Lambda under AWS Service Role.
  • Type "basic" in the filter box and choose the AWSLambdaBasicExecutionRole, and click Next Step.
  • Enter a name that identifies this role and Create role.

To create a Lambda function

  1. Sign in to your AWS account, and click Services
  2. On the AWS Console, under Compute, select Lambda.
  3. Make sure you’ve selected:

    • N.Virginia for English (US) skills
    • EU (Ireland) for English (UK), or German skills.

    The region is displayed in the upper right corner. Providing your Lambda function in the correct region prevents latency issues.

  4. Click Create a Lambda function.
  5. On the Select blueprint page, Select the Blank Function.
  6. On the Configure triggers page, Click the dashed square to select a trigger. Choose Alexa Smart Home from the displayed list.
  7. Add the Skill ID for your skill from the Developer Console.
  8. Optionally check Enable trigger. This enables the Amazon Alexa service to call your Lambda function. It’s recommended that you enable the trigger later, once you have completed the implementation and testing of your Lambda function.
  9. Click Next.
  10. On Step 3: Configure function, enter the following:

    • Name: A name for your Lambda function. This name is appears in the AWS console and is also returned by the AWS command-line interface (CLI) ListFunctions API. It should be unique across your Lambda functions.
    • Description: Optionally provide a description.
    • Runtime: Select Python 2.7. Lambda also supports Node.js and Java, but the example you will work with is in Python.
  11. For Lambda function code, make sure Edit code inline is selected.
  12. You can create a Lambda function in Node.js, Java, Python, C#, or Go. This example uses Python. Copy and paste the following Python code into the code editor. This code provides a starting point for implementing a video skill. The code determines the request type by determining the namespace and name values in the message header. The namespace specifies whether the request is a Discovery or ChannelControl request, and either the handleDiscovery or handleChannelControl function is called. For a ChannelControl request, the name property specifies the kind of request. In this example code, the only request type detected is a ChangeChannel. The response is not fully implemented. You should handle every type of request a user would make to your skill, and provide the correct response headers and payload. For information about all of the request and response messages, see the interface reference topics such as Alexa.Discovery or Alexa.PlaybackController.

    def lambda_handler(event,context):
              namespace = event['directive']['header']['namespace']
              if namespace == 'Alexa.Discovery':
                 return handleDiscovery(context,event)
              elif namespace == 'Alexa.ChannelController':
                return handleChannelControl(context,event)
        
    def handleDiscovery(context, event):
             payload = {}
             header = {
                    "messageId": event['directive']['header']['messageId'],
                    "name": "Discover.Response",
                    "namespace": "Alexa.Discovery",
                    "payloadVersion": "3"
             }
       
             if event['directive']['header']['name'] == 'Discover':
                 payload = {
                     "endpoints": [
                         {
                             "capabilities": [
                                 {
                                     "interface": "Alexa.RemoteVideoPlayer",
                                     "type": "AlexaInterface",
                                     "version": "1.0"
                                 },
                                 {
                                     "interface": "Alexa.ChannelController",
                                     "type": "AlexaInterface",
                                     "version": "1.0"
                                 },
                                 {
                                     "interface": "Alexa.PlaybackController",
                                     "version": "1.0",
                                     "type": "AlexaInterface"
                                  }
                             ],
                             "endpointId": "videoDevice-001",
                             "description": "Device description that's shown to the customer",
                             "displayCategories": [],
                             "friendlyName": "Upstairs Amazon Player",
                             "manufacturerName": "Amazon"
                         }
                     ]
                 }
             response = {
                 'header': header,
                 'payload': payload
             }
             return {'event': response}
       
    def handleChannelControl(context, event):
             payload = {}
             header = {}
             messageId = event['directive']['header']['messageId']
             if event['directive']['header']['name'] == 'ChangeChannel':
                 header = {
                     "namespace":"Alexa.ChannelController",
                     "name":"ChannelChanged",
                     "payloadVersion":"3",
                   "  messageId": messageId
                 }
             response = {
                 'header': header,
                 'payload': payload
             }
             return { 'event': response }
    
  13. On the Configuration For Handler, for this example, leave the default name lambda_function.lambda_handler. A function handler is the main entry point for a Lambda function, and you specify it with the format fileName.entryPointFunctionName. For this example, the file name is lambda_function and the lambda_handler function is the entry point in this code.
  14. For Role, you attach a role that enables Lambda execution. If needed you should have created one in a previous step. Select Choose an Existing role and find the role in the Existing Role list.
  15. Leave the Tags and Advanced settings as-is and click Next.
  16. On the Review page, you should see something similar to the following:

  17. Click Create function.
  18. On the summary page, copy the Amazon Resource Name (ARN) for your Lambda function, which is found in the upper right corner, into your clipboard. You will use this value to finish configuring the video skill in the developer console. The ARN should be similar to the following: ARN -arn:aws:lambda:us-east-1:025463977285:function:myVideoFunction

Test the Lambda Function in the AWS Console

  1. If you want to perform a quick test of the Discovery request in the Lambda code editor, you can click on Test and for the Sample event template, leave the default Hello World. Replace the entire contents of the text editor with the following code.

     {
        "directive":{
           "header":{
              "messageId":"12efe1cb-7a9c-4baf-9776-074d9166b5b8",
              "name":"Discover",
              "namespace":"Alexa.Discovery",
              "payloadVersion":"3"
           },
           "payload":{
              "scope":{
                 "type":"BearerToken",
                 "token":"some-access-token"
              }
           }
        }
     }
    
  2. Select Save and test to execute the test. If successful, the Execution result should be similar to the following:

{
  "event": {
    "header": {
      "payloadVersion": "3",
      "namespace": "Alexa.Discovery",
      "name": "Discover.Response",
      "messageId": "12efe1cb-7a9c-4baf-9776-074d9166b5b8"
    },
    "payload": {
      "endpoints": [{
        "endpointId": "videoDevice-001",
        "capabilities": [{
            "interface": "Alexa.RemoteVideoPlayer",
            "version": "1.0",
            "type": "AlexaInterface"
          },
          {
            "interface": "Alexa.ChannelController",
            "version": "1.0",
            "type": "AlexaInterface"
          },
          {
            "interface": "Alexa.PlaybackController",
            "version": "1.0",
            "type": "AlexaInterface"
          }
        ],
        "manufacturerName": "Amazon",
        "friendlyName": "Upstairs Amazon Player",
        "displayCategories": [],
        "description": "Device description that's shown to the customer"
      }]
    }
  }
 }

Finish Registering Your Skill in the Developer Console

  1. Navigate back to your skill in the Developer Console.
  2. Under 2. Video Skill Service endpoint, in the Default endpoint box, provide the ARN number from the Lambda function you created and Click Save.

Provide Account Linking Information

Select the Account Linking page. This section requires account information from your OAuth 2.0 provider, which enables customers to associate their device cloud account with your smart home skill. You can use Login with Amazon or another OAuth provider for this section. You provide:

  • Authorization URI for your OAuth provider
  • Client ID for your OAuth provider
  • A Scope, if required by your OAuth provider
  • Access token URI for your OAuth provider
  • Client Secret associated with your Client ID

For more details and instructions about the required fields, see Configure Authorization Code Grant. For an overview of account linking in video skills, see:

Test Your Skill

When your implementation is complete, and you've tested your Lambda function, you can functionally test your smart home skill.

  1. Make sure you have a smart home trigger added and enabled. To check this, go to the Lambda console, select your skill, and make sure you have an Alexa Smart Home trigger.
  2. Sign in to the Alexa app (available on Android, IOS or the web at https://alexa.amazon.com) with the same credentials as your developer account.
  3. Find your skill in the Alexa app. To do this, go to Skills, and tap Your Skills in the upper right corner of the All Skills page. Scroll to DEV SKILLS and find your skill.
  4. Click the ENABLE button to enable the skill, and you will be directed to account-link the skill to a device cloud account. If you are unable to complete account linking, make sure you are using valid credentials for the device cloud. Otherwise, it is likely there is an issue with account-linking information you provided in the developer console. For help with this, see Alexa: Debugging account linking in the developer forums. If you want to remove account linking later, you should disable your skill in the Skills tab.
  5. Return to the developer console, open your skill and on the Test page, move the slider to Yes. Use the Alexa Simulator to give Alexa commands using the utterances based on capabilities your skill supports. Make sure and test the skill with valid utterances and invalid ones, and in a variety of conditions, such as with a target device powered off. For a list of utterances and recommended test cases, see the Testing Guide. The test cases provided contain tests very similar to the tests used during skill certification testing. Running these tests and addressing issues before submitting for certification is an important step to get your skill published and available to customers as fast as possible. When issues are found during self-testing, usually they are much easier to fix, and you are more likely to pass certification the first time.
  6. When you are satisfied with your smart home skill’s performance, you can, provide it for beta testing or submit it for certification.

Provide Launch Information

Next move to the Distribution page. The information you provide here displays with your skill in the Alexa app and is required unless noted as optional.

  • Select Distribution, and on the English (US) Store Preview page, specify:

    • Public Name.
    • One Sentence Description
    • Detailed Description
    • Example Phrases
    • Small Skill Icon
    • Large Skill Icon
    • Keywords
    • Privacy Policy URL
    • Terms of Use URL.
  • Click Save and Continue

On the Privacy and Compliance page, answer the questions provided. For Testing Instructions, provide test account credentials.

  • Click Save and Continue
  • On the Availability page, check whether your skill is public, or for use by Alexa for Business Organizations.
  • Select the countries and regions you would like to distribute your skill
  • Click Save and Continue

Optionally do a Beta Test

At this point, the Beta Test button will be enabled, and you can complete information to start a beta test. For more information, see Skills Beta Testing.

Submit Your Skill for Certification

If you have completed all of the fiends successfully, you should see a large green check mark and Your skill is ready for submission.

  • At the bottom of the page, click Submit for review.

Congratulations! You’ve successfully created and submitted a video skill for certification. You should hear from the certification team in a few days with the status of your skill; whether it’s passed certification or whether there are issues to fix. When your skill passes certification and is available for customers, its status will change to Live in the developer console.

Submit Changes to a Live Skill

Once your skill Status is Live, any changes to the skill must be certified. For example, your skill must be recertified when you change the skill metadata or the AWS Lambda function. The certification review varies depending on the changes, and updating the Lambda function may cause additional review.

A new Development version is automatically created in the developer console and displays directly following your Live skill. This version has the same information as the original live version. You can use it to continue to work on your skill to improve it and add features.

When you submit your updated skill, use the Testing Instructions field to provide a change log detailing the changes you made.

Update your Lambda function

Do the following to update your AWS Lambda function:

  1. Create a new lambda function with a new ARN, and copy the code from your live Lambda function into the new Lambda function.
  2. Make your updates in the new Lambda function. Avoid updating the live Lambda function that supports your live skill, and avoid Lambda aliases or versioning because they do not work reliably once your skill is updated.
  3. In the development version of your skill, update the Lambda ARN configuration to point to the new Lambda ARN.

After your skill is recertified and the status is live, your skill points to the new Lambda ARN. You can then deprecate the previous Lambda function or use the function for future development or updates.