amazon.alexa

Alexa Developer Console Setup

  1. Open the Alexa Developer Console
  2. Select an existing skill or create a new skill. For a new skill:
    a. Select Custom for your model.
    b. Select Provision your own for your skill's backend resources.
    c. Select Hello World Skill.
  3. Make sure you're on the Build tab.
  4. Select the Invocation menu item and specify a unique invocation in
    Skill Invocation Name form.
  5. Click Save Model.

Interaction Model & Webhook Setup

Interaction Model

First you need to setup your skill's Interaction Model to allow Alexa to
send user utterances to the Meya webhook.

Under the Build tab, select Interaction Model > JSON Editor.
Then copy the following JSON object and paste it into the JSON editor
(make sure the invocationName is set correctly):

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "YOUR_INVOCATION",
            "intents": [
                {
                    "name": "CatchAll",
                    "slots": [
                        {
                            "name": "any",
                            "type": "AMAZON.Person"
                        }
                    ],
                    "samples": [
                        "{any}"
                    ]
                },
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": [
                        "cancel"
                    ]
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": [
                        "i need help",
                        "help me",
                        "help"
                    ]
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": [
                        "stop"
                    ]
                },
                {
                    "name": "AMAZON.NavigateHomeIntent",
                    "samples": [
                        "reset",
                        "go home",
                        "restart"
                    ]
                }
            ],
            "types": []
        }
    }
}
  • Click the Save Model button.
  • Click Build Model. Alexa will start training the Interaction Model.

Webhook Setup

1. Add the Alexa Integration

The first thing you need to do is add the Alexa integration to your app,
you do this by creating a YAML file in your app that specifies the Alexa
integration element.

Here is an example: save the following YAML to a file called alexa.yaml
in your app's integration/ directory:

type: meya.amazon.alexa.integration
skill_id: (@ vault.alexa.skill_id )

Properties:

  • id: this is optional, if you do not provide this then the id of the
    integration will be the dot path of the YAML file e.g.
    integration.alexa.
  • skill_id: this is the Skill ID that was assigned when you first
    created the skill. In this case we saved the Skill ID in the apps' vault.
    You can find the Skill ID under the Build > Endpoint section.

Next you need to get the Skill ID and add it to the app's vault:

  1. Download you app's vault file: meya vault download --file vault.secrets.yaml
  2. Get the Skill ID from the Alexa Developer Console:
    a. Go to Build > Endpoint
    b. Select AWS Lambda ARN
    c. Copy the Skill ID
  3. Add the alexa.skill_id key to the vault.secrets.yaml file. Paste the
    Skill ID as the value of the alexa.skill_id key.
  4. Upload the app's vault file: meya vault upload --file vault.secrets.yaml
  5. Push your app: meya push

2. Get Your Webhook URL

Next you need to run meya webhooks to get a list of webhooks for all the
integrations you've added to your app. Search for Alexa webhook
and copy the webhook URL.

3. Setup the Skill's Endpoint

  1. Go to the Build tab in the Alexa Developer Console.
  2. Go to the Endpoint section.
  3. Select the HTTPS option.
  4. Paste the webhook URL in the Default Region form.
  5. Select the My development endpoint has a certificate from a trusted
    authority
    option for the Select SSL certificate type drop down
    form.
  6. Click Save Endpoints.

Test Your Integration

First make sure you've pushed your latest app changes to ensure the Alexa
integration is loaded.

meya push
  1. Select your skill in the Alexa Developer Console.
  2. Click on the Test tab.
  3. Make sure you enable testing by selecting Develop in the drop down.
  4. Initiate the conversation with saying or typing your invocation.

Element details

type: meya.amazon.alexa.integration
class: AlexaIntegration
path: /meya/amazon/alexa/integration/integration.py
signature: -

Fields

fielddescription               requiredsignaturedefaulttype
specOverride the original spec for this element.nullSpec
enabledEnables the integration, allowing it to process events and HTTP/WS entries.truebool
filterSpecifies the GridQL to filter rx_sub, rx, tx, tx_pubentries. Check the integration filtering guidefor more info.rx_sub: true
rx: true
tx: true
tx_pub: true
IntegrationFilter
verify_tokenThe token to be verified for each incoming request. You need to add the verify_token=YOUR_TOKEN query parameter to integration's webhook URL.nullstr
max_attachment_sizeControls maximum attachment size supported by the integration in bytes.nullint
markdownThe markdown features that are supported by this integration. Check the Markdown guide for more info.falselist
bool
typingWhen set to false, all typing indicators received by the integration will be ignored.truebool
skill_idstr
catch_all_intent_name"CatchAll"str
unhandled_intent_text"Sorry I could not help with that. Please try again."str

Usage reference

Basic

type: meya.amazon.alexa.integration
skill_id: STRING

Full

type: meya.amazon.alexa.integration
spec:
  type: STRING
  data:
    STRING: ANY
  timeout: 123
  trigger_when: ANY
enabled: false
filter:
  rx_sub: STRING
  rx: STRING
  tx: STRING
  tx_pub: STRING
verify_token: STRING
max_attachment_size: 123
markdown:
  - format|linkify|breaks|typographer
typing: false
skill_id: STRING
catch_all_intent_name: STRING
unhandled_intent_text: STRING