Get Slot Value Alexa

  

Alexa doesn't support a way to get all the text the way you're looking to do. Making a CatchAll slot – Developer Feature Requests, At the moment there isn't the possibility to use a CatchAll slot. We can use SearchQuery but only if there isn't any custom slot in the utterance. Alexa lets us define custom slot names – these can be associated with any spoken text. For example, I might want the slot name “car” to be sent whether the user says “car” or “automobile” or “vehicle” or any other synonym. In my case, I want to send my API the ID Code of a hospital. I can get the value fine using this.event.request.intent.slots.RecipeName.value;, but since when it gets synonyms it returns the synonym and not the main value itself I want to use the ID as it will be consistent across all synonyms. I'm normally a Scala developer not a Javascript one so I'm not sure if I'm just messing up the JS syntax or what.

I want to build custom commands to use with Echo

The built-in Alexa integration allows you to integrate Home Assistant into Alexa/Amazon Echo. This integration will allow you to query information and call services within Home Assistant by using your voice. Home Assistant offers no built-in sentences but offers a framework for you to define your own.

Requirements

  • Amazon Developer Account. You can sign on here.
  • An AWS account is need if you want to use Alexa Custom Skill API. Part of your Alexa Custom Skill will be hosted on AWS Lambda. However you don’t need worry the cost, AWS Lambda allow free to use up to 1 millions requests and 1GB outbound data transfer per month.
  • The Alexa Custom Skill API also needs your Home Assistant instance to be accessible from the internet via HTTPS on port 443 using a certificate signed by an Amazon approved certificate authority, this is so account linking can take place. Read more on our blog about how to set up encryption for Home Assistant. When running Home Assistant using the Duck DNS add-on is the easiest method.

Alexa Skill Get Slot Value Java

Create Your Amazon Alexa Custom Skill

  • Log in to the Amazon developer console
  • Click the Alexa button at the top of the console
  • Click the yellow “Add a new skill” button in the top right
    • Skill Type: Custom Interaction Model (default)
    • Name: Home Assistant
    • Invocation name: home assistant (or be creative, up to you)
    • Version: 1.0
    • Endpoint: This will be the ARN for the Lambda Function you will create next.

You can use this specially sized Home Assistant logo as the large icon and this one as the small one.

Create Your Lambda Function

The Alexa Custom skill will trigger a AWS Lambda function to process the request, we will write a small piece of code hosted as a Lambda function to basically redirect the request to your Home Assistant instance, then the Alexa integration in Home Assistant will process the request and send back the response. Your Lambda function will deliver the response back to Alexa.

OK, let’s go. You first need sign in your AWS console, if you don’t have an AWS account yet, you can create a new user here with 12-month free tier benefit. You don’t need worry the cost if your account has already passed the first 12 months, AWS provides up to 1 million Lambda requests, 1GB of outbound data and unlimited inbound data for free every month for all users. See Lambda pricing for details.

Create an IAM Role for Lambda

The first thing you need to do after you sign in to the AWS console is to create an IAM Role for Lambda execution. AWS has very strict access control, you have to explicitly define and assign the permissions.

  • Click Service in top navigation bar, expand the menu to display all AWS services, click IAM under Security, Identity, & Compliance section to navigate to IAM console. Or you may use this link
  • Click Roles in the left panel, then click Create role, select AWS Service -> Lambda in the first page of the wizard, then click Next: Permissions
  • Select AWSLambdaBasicExecutionRole policy, then click Next: Tags. (Tips: you can use the search box to filter the policy)
  • You can skip Add tags page, click Next: Review.
  • Give your new role a name, such as AWSLambdaBasicExecutionRole-Intents, then click Create role button. You should be able to find your new role in the roles list now.

Create a Lambda function and add code

Next you need to create a Lambda function.

  • Click Service in top navigation bar, expand the menu to display all AWS services, click Lambda under Compute section to navigate to Lambda console. Or you may use this link
  • IMPORTANT Your current region will be displayed in the top right corner. Make sure you select the right region based on your Amazon account’s country:
    • US East (N.Virginia) region for English (US) or English (CA) skills
    • EU (Ireland) region for English (UK), English (IN), German (DE), Spanish (ES) or French (FR) skills
    • US West (Oregon) region for Japanese and English (AU) skills.
  • Click Functions in the left navigation bar, display list of your Lambda functions.
  • Click Create function, select Author from scratch, then input a Function name.
  • Select Python 3.6 or Python 3.7 as Runtime.
  • Select Use an existing role as Execution role, then select the role you just created from the Existing role list.
  • Click Create function, then you can configuration detail of Lambda function.
  • Under Configuration tab, expand Designer, then click Alexa Skills Kit in the left part of the panel to add a Alexa Skills Kit trigger to your Lambda function.
  • Scroll down a little bit, you need to input the Skill ID from the skill you created in the previous step. (You may need to switch back to the Alexa Developer Console to copy the Skill ID).
  • Click your Lambda Function icon in the middle of the diagram and scroll down, you will see a Function code window.
  • Clear the example code and copy the Python script from this GitHub Gist.
  • Click the Deploy button of the Function code window.
  • Scroll down again and you will find Environment variables, click on Edit button and add the following environment variables as needed:
    • BASE_URL (required): your Home Assistant instance’s Internet accessible URL with port if needed. Do not include the trailing /.
    • NOT_VERIFY_SSL (optional): set to True to ignore the SSL issue, if you don’t have a valid SSL certificate or you are using self-signed certificate.
    • DEBUG (optional): set to True to log debugging messages.
    • LONG_LIVED_ACCESS_TOKEN (optional, not recommended): you will connect your Alexa Custom skill with your Home Assistant user account in the later steps, so that you don’t need to use long-lived access token here. However, the access token you got from login flow is only valid for 30 minutes. It will be hard for you to test lambda function with the access token in test data. So for your convinces, you can remove the access token from the test data, generate a long-lived access token put here, then the function will fall back to reading the token from environment variables. (tips: You did not enable the security storage for your environment variables, so your token saved here is not that safe. You should only use it for debugging and testing purpose. You should remove and delete the long-lived access token after you finish the debugging.)
  • Save your environmental variables by clicking the Save button.
  • Next, copy the ARN displayed in the top of the page, which is the identify of this Lambda function. Set the end point of the custom Alexa Skill you created earlier to this value.

Account Linking

Alexa can link your Amazon account to your Home Assistant account. Therefore Home Assistant can make sure only authenticated Alexa requests are actioned. In order to link the account, you have to make sure your Home Assistant instance can be accessed from the Internet.

  • Log in to the Amazon developer console
  • Go to the Alexa Skills page.
  • Find the skill you just created and click Edit in the Actions column.
  • Click ACCOUNT LINKING in the left navigation bar of the build page
  • Input all information required. Assuming your Home Assistant can be accessed by https://[YOUR HOME ASSISTANT URL:PORT]
    • Authorization URI: https://[YOUR HOME ASSISTANT URL]/auth/authorize

    • Access Token URI: https://[YOUR HOME ASSISTANT URL]/auth/token

      • Note: you must use a valid/trusted SSL Certificate and port 443 for account linking to work
    • Client ID:

      • https://pitangui.amazon.com/ if you are in US
      • https://layla.amazon.com/ if you are in EU
      • https://alexa.amazon.co.jp/ if you are in JP or AU

      The trailing slash is important here.

    • Client Secret: input anything you like, Home Assistant does not check this field

    • Client Authentication Scheme: make sure you selected Credentials in request body. Home Assistant does not support HTTP Basic.

    • Scope: input intent. Home Assistant doesn’t use this yet, we may use it in the future when we allow more fine-grained access control.

  • You can leave Domain List and Default Access Token Expiration Time as empty.
  • Click Save button in the top right corner.
  • Next, you will use the Alexa Mobile App or Alexa web-based app to link your account.
    • Open the Alexa app, navigate to Skills -> Your Skills -> Dev Skills
    • Click the Custom skill you just created.
    • Click Enable.
    • A new window will open to direct you to your Home Assistant’s login screen.
    • After you successfully login, you will be redirected back to Alexa app.

Configuring your Amazon Alexa skill

Alexa works based on intents. Each intent has a name and variable slots. For example, a LocateIntent with a slot that contains a User. Example intent schema:

To bind these intents to sentences said by users you define utterances. Example utterances can look like this:

This means that we can now ask Alexa things like:

  • Alexa, ask Home Assistant where Paul is
  • Alexa, ask Home Assistant where we are

Configuring Home Assistant

When activated, the Alexa integration will have Home Assistant’s native intent support handle the incoming intents. If you want to run actions based on intents, use the intent_script integration.

Slot

To enable Alexa, add the following entry to your configuration.yaml file:

Working With Scenes

One of the most useful applications of Alexa integrations is to call scenes directly. This is easily achieved with some simple setup on the Home Assistant side and by letting Alexa know which scenes you want to run.

First, we will configure Alexa. In the Amazon Interaction module add this to the intent schema:

Then create a custom slot type called Scenes listing every scene you want to control:

Custom slot type for scene support.

The names must exactly match the scene names (minus underscores - Amazon discards them anyway and we later map them back in with the template).

In the new Alexa Skills Kit, you can also create synonyms for slot type values, which can be used in place of the base value in utterances. Synonyms will be replaced with their associated slot value in the intent request sent to the Alexa API endpoint, but only if there are not multiple synonym matches. Otherwise, the value of the synonym that was spoken will be used.

Custom slot values with synonyms.

Add a sample utterance:

Then add the intent to your intent_script section in your HA configuration file:

Here we are using templates to take the name we gave to Alexa e.g., downstairs on and replace the space with an underscore so it becomes downstairs_on as Home Assistant expects.

Now say Alexa ask Home Assistant to activate <some scene> and Alexa will activate that scene for you.

Adding Scripts

We can easily extend the above idea to work with scripts as well. As before, add an intent for scripts:

Create a custom slot type called Scripts listing every script you want to run:

Custom slot type for script support.

Add a sample utterance:

Then add the intent to your intent_script section in your HA configuration file:

Now say Alexa ask Home Assistant to run <some script> and Alexa will run that script for you.

Support for Launch Requests

There may be times when you want to respond to a launch request initiated from a command such as “Alexa, Red Alert!”.

To start, you need to get the skill id:

  • Log into Amazon developer console
  • Click the Alexa button at the top of the console
  • Click the Alexa Skills Kit Get Started button
    • Locate the skill for which you would like Launch Request support
    • Click the “View Skill ID” link and copy the ID

The configuration is the same as an intent with the exception being you will use your skill ID instead of the intent name.

Giving Alexa Some Personality

In the examples above, we told Alexa to say OK when she successfully completed the task. This is effective but a little dull! We can again use templates to spice things up a little.

First create a file called alexa_confirm.yaml with something like the following in it (go on, be creative!):

Then, wherever you would put some simple text for a response like OK, replace it with a reference to the file so that:

becomes:

Alexa will now respond with a random phrase each time. You can use the include for as many different intents as you like so you only need to create the list once.

alexa utterances wildcard
alexa get user input
sample utterance must include a carrier phrase

I've got a chatbot which is plugged to backend and DialogFlow/ApiAI. I'm trying to set up a skill in Alexa so that I can catch everything that is said to my skill and then forward it to my backend so that i can use my existing infrastructure and convo design.

I've been struggling with Alexa to set up an intent that catch everything and just forward it.From what I understand, you are supposed to use AMAZON.SearchQuery, but I'm getting the following error when i try to set the intent up:

Build FailedSample utterance 'CATCH_ALL {any}' in intent 'CATCH_ALL' must include a carrier phrase. Sample intent utterances with phrase types cannot consist of only slots. Error code: MissingCarrierPhraseWithPhraseSlot -

Does anyone know how to do so ? I tried to use AMAZON.Literal as well, but it seems to be deprecated and I cannot build the skill when i use it.I'm kinda stuck. It would be great if someone had a solution...

Thanks.

I finally managed to do so by doing something like this:

the samples for the intent CATCHALL indicates the number of word you want to catch. So lige this, i will catch any sentence between one and this 5 words.

I'm not sure if this is going to be a problem when I'll submit the app, though.

Note that AMAZON.LITERAL is not supported for any language other than English (US), so this is not a solution for me as it's a french and english chatbot. So i'm back again at the beginning...

edit: Here is the solution without LITERAL:

{ 'interactionModel': { 'languageModel': { 'invocationName': 'mon invocation', 'intents': [ { 'name': 'AMAZON.CancelIntent', 'samples': [] }, { 'name': 'AMAZON.HelpIntent', 'samples': [ 'que puis-je faire' ] }, { 'name': 'AMAZON.StopIntent', 'samples': [ 'je veux quitter' ] }, { 'name': 'CATCH_ALL', 'slots': [ { 'name': 'any', 'type': 'ANYTHING' } ], 'samples': [ '{any}' ] } ], 'types': [ { 'name': 'ANYTHING', 'values': [ { 'name': { 'value': 'hey' } }, { 'name': { 'value': 'hey hey' } }, { 'name': { 'value': 'hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey hey hey hey hey hey' } }, { 'name': { 'value': 'hey hey hey hey hey hey hey hey hey hey hey hey' } } ] } ] } }}

CatchAll Intent with dialog model, This involves the alexa's NLP as it should come as a request from the cloud pointing to the CatchAll Intent when none of the other intents matches� Science projects, work projects and everything in between. Portal does it all. Group video calls, Alexa built-in, Story Time with AR, & more to keep you connected.

Unfortunately, there is no solution at this time. Alexa doesn't support a way to get all the text the way you're looking to do.

Making a CatchAll slot – Developer Feature Requests, At the moment there isn't the possibility to use a CatchAll slot. We can use SearchQuery but only if there isn't any custom slot in the utterance. Alexa - catchall. Ask Question Asked 1 year, 8 months ago. Active 8 months ago. Viewed 2k times 6. 2. I've got a chatbot which is plugged to backend and DialogFlow

You can replace the AMAZON.SearchQuery with AMAZON.Person. Usually AMAZON.SearchQuery require a phrase along with the slot.Using AMAZON.Person there is no need of phrase along with the slot. It would accept any values that you pass to the Intent.

Is there a CatchAll Intend? � Issue #213 � alexa-js/alexa-app � GitHub, Probably worthy of some research to figure out what happens on the JSON side, when user specifies something but Alexa can't figure out what� Alexa create CatchAll custom slot with custom slot type - Catch ALL I need to create intent for Alexa to catch the whole text.

You can create a custom slot with some random words.

How to create a 'catchall' intent - Questions, { 'name': 'WordScoringIntent', 'phrases': [ '{words}' ], 'inputs': [ { 'name': 'words' , 'type': { 'alexa': 'AMAZON.SearchQuery' } } ] },. You won't even need Alexa's help when you stash your keys in this zany catchall. We all need help keeping up with keys, change, and other quick grab essentials. With a marble like outer base and tan vegan leather inside panels. Made in USA.

Alexa Catchall Tray – Femail Creations, You won't even need Alexa's help when you stash your keys in this zany catchall. We all need help keeping up with keys, change, and other quick grab� What marketing strategies does Catchall use? Get traffic statistics, SEO keyword opportunities, audience insights, and competitive analytics for Catchall. catchall.co.kr Competitive Analysis, Marketing Mix and Traffic - Alexa

Advanced, To write an Alexa skill that matches on raw text instead of on intents, try out our experimental CatchAll Mode. The rest of this walkthrough assumes CatchAll� Alexa (whose name is partly inspired by the legendary Library of Alexandria in Egypt) is the voice platform that powers Amazon’s Echo speakers, including the standard Echo (2019 version), the

Advanced: Writing for Alexa (Catch-All Mode), 'Catch-All Mode' is an experimental mode for capturing raw user input that users say to your Alexa skill and using that input to match against triggers. Simply put� YAPISHI Valet Tray Leather Catchall Jewelry Tray Dice Box Bedside Tray Key Phone Coin Change Watches and Candy Holder Sundries Entryway Tray 4.5 out of 5 stars 250 $8.99 $ 8 . 99 $12.99 $12.99

Comments

Alexa Skill Get Slot Value

  • I would like to achieve the same thing as you but I don't understand all those hey hey. it will just catch hey sentences in the end....
  • Well, as there is no other matching pattern, the 'hey hey' will always be the closest it will find. Finally, i generated x sentences with random words, it achieve the same things, but it's easier to understand when you read. The key thing is to have sentences with always one word more than the previous. otherwise, it won't catch the whole sentence.
  • found a solution, I edited the response with the solution
  • @JulienCoo yes, but that's not a 'catchall' solution.
  • 'AMAZON.SearchQuery require a phrase along with the slot' - this is the key!

Get Slot Value Alexa Dot

Hot Questions