-1

I need help with creating shared slots. I visited the official page: https://developer.amazon.com/en-US/docs/alexa/smapi/create-a-slot-type-to-use-in-multiple-skills.html#api-endpoint-and-header

however, I am unable to understand how to initiate the process of creating shared slots. Can someone guide me?

1 Answers1

0

You need to use ask cli, I assume you've already installed and configured it on your machine in order to deploy skill. If so - skip the first section:

  1. Install ask cli tool according to ASK CLI Quick Start
  2. Once it's installed and configured you need to generate auth token using your client-id and secret from your Security Profile, configured to Use SMAPI:

ask util generate-lwa-tokens --client-id <your-client-id> --client-confirmation <your-client-secret>

  1. It should open the website, click Allow and go back to the console, there should be something like:
The LWA tokens result:
{
  "access_token": "Atza|IwEBIJDuJivzzkceXtesWGS5tYIKRZlK0NKp9OWP8TXh4HlFSQxTiMD4V-1QeoSHa8C6(...)",
  "refresh_token": "Atzr|IwEBIOyzzw_7(...)",
  "token_type": "bearer",
  "expires_in": 3600,
  "expires_at": "2020-06-03T13:21:04.922Z"
}
  1. Copy the access_token and use it in Authentication header: Authorization: Bearer access_token in requests from the doc site you've linked.

Hint: you can obtain your vendorId here:

curl --location --request GET 'https://api.amazonalexa.com/v1/vendors' \
--header 'Authorization: Bearer access_token'

Sample CURL request:

curl --location --request POST 'http://api.amazonalexa.com/v1/skills/api/custom/interactionModel/slotTypes/' \
--header 'Authorization: Bearer access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
     "vendorId": "MBT******E",
     "slotType": {
         "name": "SharedSlot",
         "description": "Your shared slot'\''s description"
     }
  }'

and response:

{
    "slotType": {
        "id": "amzn1.ask.interactionModel.slotType.e4fc2751-e4be-48c5-9be0-cd193a2ffafb"
    }
}
slawciu
  • 775
  • 4
  • 15
  • thank you so much for helping me out. I have created my shared slot. How can I use it my skill now? How do I link my slot with the created slot type in the dev console? – Deepak Sharma Jun 04 '20 at 11:10
  • Just follow the steps from the doc: https://developer.amazon.com/en-US/docs/alexa/smapi/create-a-slot-type-to-use-in-multiple-skills.html#use-the-slot-type-api – slawciu Jun 04 '20 at 11:40
  • and it looks you can access it only by defining usage in the interaction model (so the skill's JSON) – slawciu Jun 04 '20 at 11:50
  • Also i am unable to list all the slot types using the command : /v1/skills/api/custom/interactionModel/slotTypes?vendorId={vendorId} – Deepak Sharma Jun 04 '20 at 12:17
  • although i enter my vendorId in it, it still returns "Invalid/epixred token" – Deepak Sharma Jun 04 '20 at 12:20
  • maybe it's expired? It's valid for 1h, then you need to refresh it or create a new one – slawciu Jun 04 '20 at 12:53