alexa-skill | A Ruby based DSL to create new Alexa Skills
kandi X-RAY | alexa-skill Summary
kandi X-RAY | alexa-skill Summary
A Ruby based DSL to create new Alexa Skills. First, install the gem. Now we'll create a simple hello world app app.rb. This sets up Rackup to run the app, just like running a Sinatra app config.ru. Now we can start the server. Now we can configure the server in the Alexa Developer Portal.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Add a slot .
- Set the card .
- Set the response .
- Set the utterance
alexa-skill Key Features
alexa-skill Examples and Code Snippets
Community Discussions
Trending Discussions on alexa-skill
QUESTION
I have an Alexa-Skill and am building a Web-App for this skill. In the skill users can buy a subscription for an ISP and in the Web-App I need to know if a user is subscribed (is entitled) to that ISP. How can I do that and is it even possible?
More information- My skill's code (written in python using the Alexa-Skills-Kit SDK) is hosted as an AWS Lambda function.
- The Skill's database as an AWS DynamoDB. The Web-App I'm developing has access to that DynamoDB.
- From the Web-App use the ask-sdk monetization_service to get the products the current user is entitled to.
First I tried invoking my skill's lambda function through the ask-sdk with a request for my skill's "getEntitledProducts" Intent. This intent stores the entitled products in the response's sessionAttributes. The request I got from the alexa developer console test tab where I (successfully) invoked the mentioned intent. Here in the developer console it works without problem
...ANSWER
Answered 2021-May-08 at 21:24One possible but not the best approach can be the database solution that you suggested but with some additional data. When the user subscribes for the first time you can always save the subscription datetime in the DB and you know for how long the subscription is valid. Then you just have to play with datetime library to know wether the user is subscribed or not.
This will not be helpful if your skill is already running and is live, but if not then this can help.
QUESTION
I'm trying to make a skill based on Cake Time Tutorial but whenever I try to invoke my skill I'm facing an error that I don't know why.
This is my invoking function.
...ANSWER
Answered 2021-Apr-05 at 21:19instead it tries to access amazon S3 bucket for some reason
First, your persistence adapter is loaded and configured on each use before your intent handlers' canHandle
functions are polled. The persistence adapter is then used in the RequestInterceptor
before any of them are polled.
If there's a problem there, it'll break before you ever get to your LaunchRequestHandler
, which is what is happening.
Second, are you building an Alexa-hosted skill in the Alexa developer console or are you hosting your own Lambda via AWS?
Alexa-hosted creates a number of resources for you, including an Amazon S3 bucket and an Amazon DynamoDb table, then ensures the AWS Lambda it creates for you has the necessary role settings and the right information in its environment variables.
If you're hosting your own via AWS, your Lambda will need a role with read/write permissions on your S3 resources and you'll need to set the bucket where you're storing persistent values as an environment variable for your Lambda (or replace the process.env.S3_PERSISTENCE_BUCKET
with a string containing the bucket name).
QUESTION
I am trying to make an Alexa skill using python backend. I am using amazon developer console to create model and code backend.
I want to retrieve user email address. I would appreciate if you could provide me with sample code. I tried many methods but none were working.
here are some codes I tried : https://github.com/alexa/alexa-skills-kit-sdk-for-python/tree/master/samples/GetDeviceAddress
I know this is device address but this was also not working, and I thought if i could get address I can get email.
Everything mentioned online is for Node, and I want to make my backend on python
...ANSWER
Answered 2021-Mar-31 at 09:04As specified in the official documentation you need to make an API call to the ASK.
For email you need to call your api_endpoint followed by /v2/accounts/~current/settings/Profile.email
For me endpoint is : https://api.eu.amazonalexa.com
therefore the complete url becomes :
https://api.eu.amazonalexa.com/v2/accounts/~current/settings/Profile.email
As far as adding the token to authorize the request it can be done by using the requests library by passing header to the get request. You can learn more about that from here
The final code should then look something like this :
QUESTION
I am trying to get geographic location in an Alexa skill. I have enabled location services in the Alexa console and I have authorized the skill to send geographic location.
The message I receive is the following:
...ANSWER
Answered 2021-Jan-31 at 23:49You're correct on geolocation not being available for most Echo devices. Stationary devices only provide the registered address, not geographic coordinates.
You can, however use a "geocoding" service to convert most addresses to coordinates. For example Google Maps has a geocoding API.
QUESTION
I'm trying to work through the steps listed here for an Alexa Skill I'm developing in Java.
I'm getting a request from Alexa which is a POST. Two of the headers are the signing certificate chain url and the signature.
Amazon SHA1 hashes then signs the entire body of the Alexa request with an X509 key, and then base64 encodes the signed body. This is the "signature." The signing certificate chain is the url where I can GET the X509 certificate chain that contains their public key.
What I need to do is base64 decode the signature, then use the X509 public key to decrypt the signature. This leaves me with a SHA1 hashed request body. Then I need to SHA1 hash the body of the request myself and compare the two.
I validate the certificate chain. I extract the public key. I hash the body of the POST and produce a derived hash value (its SHA1withRSA). I base64 decode the "signature" then decrypt it with the public key to get the asserted hash value.
I've not been able to produce a derived hash value that matches the asserted hash value. This is where I'm stuck and I can't understand what I'm doing wrong. I don't really understand this encryption stuff very well so perhaps I'm missing something super simple.
Step 8 from the link above is where I'm stuck.
First, I borrowed the code from the alexa SDK here. The problem is this code doesn't seem to work:
...ANSWER
Answered 2021-Jan-14 at 05:28First, digital signature is NOT encryption with the privatekey; Amazon is deceiving you there, see https://security.stackexchange.com/questions/159282/can-openssl-decrypt-the-encrypted-signature-in-an-amazon-alexa-request-to-a-web which was basically the same question except without Java. And Java crypto exacerbates this because it was designed in the 1990s when this mistake was still fairly common, and as a result the Cipher
object which is intended to be for encryption and decryption accepts the 'backwards' use of RSA keys and internally changes them to the operations used in the Signature
scheme 'NoneWithRSA' (which might be considered a pseudo-scheme since it doesn't really match PKCS1).
Expanding on that point, the difference between your 'decrypted' (more properly, recovered) value and a simple hash is that the PKCS1v1 signature scheme used here, now retronymed RSASSA-PKCS1-v1_5 in PKCS1v2, actually has four steps:
#1 hash the data
#2 encode the hash value and algorithm in a DigestInfo ASN.1 structure encoded in DER, which amounts to adding a fixed prefix per algorithm
#3-5 prepend padding of the form 00 01 FF...(at least 8) 00
(8.2.1#2) treating the result as a number m, apply RSASP1 which does m ^ d mod n (or for verify 8.2.2#2 apply RSAVP1 which does s ^ e mod n; this is stated as before the three padding steps above but actually can just as well be after)
The backwards-Cipher operation performs, or reverses, only the third and fourth steps above; you have added the first step, but not the second, so your 'decrypted' value is actually a DigestInfo structure that contains some metadata, the OID for the SHA1 algorithm, and the hash value that should correspond to the data.
This failure to create or remove the DigestInfo structure is also a very common mistake and problem; see my list at https://crypto.stackexchange.com/questions/87006/why-is-data-signed-with-sha256-rsa-pkcs-and-digest-signed-with-rsa-pkcs-differen/#87022 .
But it doesn't match. The hash value embedded in the recovered DigestInfo is not the same as the hash value you computed on your data (and I also get). This strongly suggests some change between your data and the data the Amazon signed, but I have no idea what; certainly your data looks superficially like an Alexa request should. Sorry :-)
QUESTION
The skill in question asks for one permission when enabling in Web or app (Outbound Notification). But, when implemented Skill Enabled Event it's not asking user to give notification permission or not. Skill enablement works itself but permission is by default No. How to make alexa to ask for permission when enabling via voice?
Can Alexa prompt them via voice to enable the outbound notification?
skill.json
...ANSWER
Answered 2020-Sep-20 at 14:04There may be a different way, but once you are in the skill I believe you will need to send an ask for permissions card. As I understand it the idea is to make sure that Amazon is involved as a third party permissions granter. This will pop a permissions request in the Alexa app on the users phone. This added layer of security just makes sure the customer saw exactly what permissions they were granting.
You can do this a few different ways in your skill. You could check the first time that the user connects and keep track of that first connection in a persistent customer data layer. Or you could just check if the user has permission when you go to use that part of the skill. If they don't respond telling the customer you sent them a card to grant permissions.
Here is more info on permission cards: https://developer.amazon.com/en-US/docs/alexa/custom-skills/request-customer-contact-information-for-use-in-your-skill.html#permissions-card-for-requesting-customer-consent
QUESTION
I am developing a Alexa Skill in Python and I need to dynamically add Entities for the user to update a Slot Type so the user can choose an option.
I the page Use Dynamic Entities for Customized Interactions there is documentation and example for Node.js and Java, but no examples for Python. Looking at the Documentation for the Python SDK, it was not clear to me how to do the same in Python.
I created a Slot Type called test and tried the following code:
...ANSWER
Answered 2020-May-24 at 21:56I found the answer in the link: https://forums.developer.amazon.com/questions/210684/dynamic-entities-in-python.html. A short example in Python:
QUESTION
I am developing an Alexa Skill (using v2 and javascript) and I'm attempting to make an API GET
call to the USDA API.
At this point I've copy/pasted from here and I'm using the USDA API example from here (with some minor changes). as an attempt just to get the connection to work and return anything that proves it worked.
The error I currently receive is: Error handled: TypeError: Cannot read property 'generalSearchInput' of undefined at Object.handle (/var/task/index.js:39:32)
at process._tickCallback (internal/process/next_tick.js:68:7)
Directly before the error I get the return of: every entry about Cottage Cheese that is in the USDA API, I.E. WAY too much from the console.log(response)
. I just want the first one, or even just the name.
Console logs have told me that I am receiving data back from the call, so I know it is working. My question is: How do I set the speechOutput
to the specific piece of information I need, rather than the entire API object that is returned?
The speechOutput
that I'm looking for should say: Cottage Cheese
The response that I am receiving is: Output from Alexa saying:
Sorry, I had trouble doing what you asked. Please try again
index.js
...ANSWER
Answered 2020-May-18 at 12:00I figured it out. Hopefully this can help somebody who may be stuck.
I was calling the API data incorrectly.
The code that did what I needed
QUESTION
I am trying to create API using node js from JSON file.
I have created a simple get request from Nodejs from the JSON file, which I am trying to remove unwanted data from json file and construct new response from that json file
My code as follows:
...ANSWER
Answered 2020-May-17 at 20:11let resData = [
{
"web-scraper-order": "1588668196-10",
"web-scraper-start-url": "https://udemycoupon.learnviral.com/coupon-category/development/page/266",
"pagenation": "",
"pagenation-href": "",
"courseid": "Redeem Offer",
"courseidhref": "https://www.udemy.com/course/amazon-alexa-101-publishing-alexa-skills-without-coding/"
},
{
"web-scraper-order": "1588668196-12",
"web-scraper-start-url": "https://udemycoupon.learnviral.com/coupon-category/development/page/266",
"pagenation": "",
"pagenation-href": "",
"courseid": "Redeem Offer",
"courseidhref": "https://www.udemy.com/course/learn-complete-oracle-apps-r12-technical-training/?couponCode=TTROAP"
}
] ;
let modifiedData = resData.map((val,ind)=>(
{
id : ind,
courseidhref:val.courseidhref,
courseTitle : val.courseidhref.split('?')[0].split('/').reverse()[1]
}
));
QUESTION
I am currently building an Alexa skill backed by Azure Functions (.NET Core/C#) and Azure AD B2C for authentication.
For the initial setup, I used mostly used the instructions found in this arcticle. Since, the article was written a couple of years ago, I had to make a few changes. In the end, I landed on the following configuration:
Azure Active Directory B2CAs I mentioned, we are using AAD B2C for authentication. Users of a related application are able to sign-up and sign-in to a React application. The idea is to provide an alternative interface for said users through Alexa intents + utterances.
I created an application for Alexa in AAD B2C with the following settings:
Properties- Web App / Web API: Yes
- Allow implicit flow: Yes
- Reply URLs: I entered the values provided by the Alexa skill setup (e.g. https://pitangui.amazon.com/api/skil/link/...); there are three different ones. I also added one for my azure function app (this is something that could be incorrect. It was part of what I did while diagnosing other earlier problems); it's in the format: https://myfuncname.azurewebsites.net/.auth/login/aad/callback (Do I even need this???)
- App ID URI: https://myorg.onmicrosoft.com/alexa
- Include native client: No
I generated a single App Key, which I'm using as the Secret in the Account Linking section in the Alexa Developer Console.
Many of the examples online mention setting an explicit expiration date here of 1 or 2 years; however, I am not presented with any options at all (i.e. no expiration option), just the code. Could this be part of the problem???
API Access- In the Published scopes section, the Scope's name is
user_impersonation
. The description is "Access this app on behalf of the signed-in user". The full scope value is: https://myorgsname.onmicrosoft.com/alexa/user_impersonation.
For API Access, I have to API entries here:
- One that uses the
user_impersonation
scope mentioned above. - The second, titled "Access the user's profile", uses:
- Acquire an id_token for users (openid)
- Acquire a refresh_token for users (offline_access)
The user flow that I'm using allows signing up and signing in, it utilizes the following configuration:
Properties
Misc
- Enable JavaScript enforcing page layout (preview): On
Token lifetime
- Access & ID token lifetimes (minutes): 60
- Refresh token lifetime (days): 14
- Refresh token sliding window lifetime: "Bounded".
- Lifetime length (days): 90
Token compatibility settings
- Issuer (iss) claim:
https:///
- Subject (sub) claim: ObjectID
- Claim representing user flow: tfp
Session behavior
- Web app session lifetime (minutes): 1440
- Web app session timeout: Rolling
- Single sign-on configuration: Tenant
- Require ID Token in logout requests: No
For the authentication layer within the Azure Function, I'm utilizing the method described in the article mentioned above.
Alexa Developer ConsoleOn the Alexa side of things, I have a really simple skill setup with the following settings:
EndpointMy endpoint uses the HTTPS option with the default region set to the fully-qualified HTTPS endpoint of my Azure Function App's handler function.
The certificate set to "My development endpoint is a sub-domain of a domain that has a wildcard ..."
Account LinkingThe account linking settings are as outlined below:
- Do you allow uses to create an account or link to ...: Toggled On
- Allow users to enable skill without account linking: Toggled On
- Allow users to link their account to your skill from within your application or website: Toggled Off
- Auth Code Grant: On
- Authorization URI:
https://myorg.b2clogin.com/myorg.onmicrosoft.com/oauth2/v2.0/authorize?p=
- Access Token URI:
https://myorg.b2clogin.com/myorg.onmicrosoft.com/oauth2/v2.0/token?p=
- Your Client ID: AAD B2C App GUID
- Your Secret: Key generated in App settings in AAD B2C for my Alexa Skill App (mentioned in the AAD B2C setup info above).
- Your Authentication Scheme: HTTP Basic
- Scope: openid and https://myorg.onmicrosoft.com/alexa/user_impersonation
- Domain List: login.microsoftonline.com and myorg.b2clogin.com Note: This is probably wrong as I didn't know what to put here. The article above doesn't mention this setting at all
- Default Access Token Expiration Time: 3600
Note: The Alexa Redirect URLS at the bottom are what I put in AAD B2C for the Reply URL section.
The ProblemNow for the most important part, The Problem. Everything seems to work at first...I'm able to go to alexa.amazon.com and utilize Link Account (which redirects me to and from my AAD B2C-driven login screen). Once I link accounts, I'm able to successfully utilize an utterance and receive a reply.
The problems starts when I wait an hour (I believe it's an hour). Attempting to initiate the Intent after an hour yields an error on the Azure Function app side of things when it tries to validate the Auth Token.
Can anyone provide me some guidance as to what I may have setup incorrectly or at least some things that I should look into? As I mentioned at the start of this question, many of the references that I'm finding online are out-of-date and do not cover all of the settings that I'm expected to utilize. Many of them are still using microsoftonline.com authority vs. b2clogin.com.
At a glance, I would assume that the problem is that the Alexa skill is failing to refresh its token after it expires after an hour. What do I need to do to ensure that it refreshes correctly?
...ANSWER
Answered 2020-Mar-21 at 16:20I think that I have enough information at this point to go ahead and answer my own question. What I found was that the offline_access
scope is necessary for Token Refresh to be possible.
Per Microsoft, "The offline_access scope gives your app access to resources on behalf of the user for an extended time. On the consent page, this scope appears as the "Maintain access to data you have given it access to" permission. When a user approves the offline_access scope, your app can receive refresh tokens from the Microsoft identity platform token endpoint. Refresh tokens are long-lived. Your app can get new access tokens as older ones expire.".
You can read more about it here.
To resolve the issue, I ensured that this scope was available in AAD B2C and added it as a referenced scope in the Alexa developer console.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install alexa-skill
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page