AWS Alexa Smart Home regular expression mismatch - alexa

I am setting up Alexa Skills for Alexa Smart Home through UI with following confirmation
When I hit save, I get following error
- String instance with value
"arn:aws:lambda:us-west-2:123456789012:function:ab-xyz-alexa-qa:7" at
property path "$.manifest.apis.smartHome.regions.NA.endpoint.uri"
does not match the regular expression:
"arn:aws:lambda:us-east-1:[0-9]{12}:function:[a-zA-Z0-9-_]+(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?(:[a-zA-Z0-9-_]+)?".
- Please make sure that "Alexa Smart Home" is selected for the event
source type, for provided arn [Invalid value] :
arn:aws:lambda:us-west-2:123456789012:function:ab-xyz-alexa-qa:7
What is wrong in this setup ?

When it comes to smart home skills specifically, Alexa is very picky.
The AWS region being used by your Lambda function is us-west-2, which is not supported for the "North America" box. For the "North America" box your AWS Lambda function must reside in US East (N. Virginia), which is us-east-1.
https://developer.amazon.com/en-US/docs/alexa/smarthome/develop-smart-home-skills-in-multiple-languages.html#deploy
To fix this then, you'll want to sign into the AWS Console, click the region dropdown menu in the upper-right, choose "US East (N. Virginia)", and re-create your Lambda function there and add the "Alexa Smart Home" trigger. Once that new Lambda function is created, use the ARN of that new Lambda function, located in us-east-1, in the "North America" box instead.

Related

Alexa model evaluation works great but intent is never called in simulator or alexa device

I'm struggling to build my Alexa Interaction model. My application is used for requesting live data from a smart home device. All i do is basically calling my Server API with a Username & Password and i get a value in return. My interaction model works perfectly for requesting the parameters, for example i can say "Temperature" and it works perfectly fine across all testing devices. For that intent i got a custom RequestType.
However for setting up Username & Password i need to use an built-it slot type: AMAZON.NUMBER. As i only need numbers for my credentials this should work perfectly fine in theory.
I got a interaction model setup which works perfectly fine when i press "Evaluate Model" in Alexa developer console. However once i go to Test on the simulator or to my real Alexa device it's absolutely impossible to call the intent. It always calls one of more other intents? (I see this in the request JSON).
Here's how the intent looks:
{
"name": "SetupUsername",
"slots": [
{
"name": "username",
"type": "AMAZON.NUMBER"
}
],
"samples": [
"my user id is {username}",
"username to {username}",
"set my username to {username}",
"set username to {username}",
"user {username}",
"my username is {username}",
"username equals {username}"
]
}
Whatever i say or type in the Simulator, i cannot call this intent. I have no overlaps from other intents. Does anyone see an issue here?
Thank you in advance
EDIT: I just realized that if you want to do account linking on Alexa you need to implement OAuth2 - maybe my intents are never called because they want to bypass me implementing my own authentication?
UPDATE:
This is the intent that is usually called instead - it's my init intent. So for example is i say "my username is 12345" the following intent is gonna be called:
UPDATE 2:
Here is my full interaction model.
(HelpIntent and SetPassword are only for testing purposes, they don't make sense right now)
It's impossible calling SetupUsername with any of the samples in my model.
You need to build the interaction model. Saving is not enough
When you develop your Interaction Model, you have to save it AND build it. Otherwise only the evaluation model will work (documentation about it).
Then when you test in the test console, you should see in the JSON Input, at the bottom, which intent was called:
"request": {
"type": "IntentRequest",
"requestId": "xxxx",
"locale": "en-US",
"timestamp": "2021-10-20T14:38:59Z",
"intent": {
"name": "HelloWorldIntent", <----------- HERE
"confirmationStatus": "NONE"
}
}

Can we get Active Directory property named Employee ID using Office365Users connector inside Power App

Inside our active directory we have a property named "Employee ID" as follow:-
so inside our PowerApp form i want to get the value of this property,,, but i checked the Office365Users connector # https://learn.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-users seems it does not provide such a data.. so how i can get the Employee ID property inside our PowerApp form? this ID is different than the ID which we can get using this formula Office365Users.MyProfile().Id which will return the internal GUID of the user, and not the number shown above.
Thanks in advance for any help.
Currently (As of 2021-09-27), there is no Out of the box connector for Power Apps that will get you employeeId. The reason is that we need to query the beta version of Microsoft Graph, as it is not query-able in the version 1.0 of the endpoint. There is hope, the new Office 365 Users Connector has a new version of Get my profile (V2) that queries the new version of the Graph interface, and allows us to select employeeId, as well as almost everything else available. The downside is that it returns a GraphUser_V1 object. So, even though the API call returns the employeeId, since Power Apps is Strongly Typed, we cannot reference employeeId as it's not a part of the GraphUser_V1 object.
Power Apps may not be able to pull the value, but Power Automate can. As a POC to get you started:
In Power Apps, create a button with the Action being running a Power Automate Flow.
Create a new flow "Power Apps button" called "GetEmployeeId".
In Power Automate, create a new step: Get my profile (V2).
Under advanced options set Select fields to employeeId
Create a new step: Parse JSON
Set Content to the body of Get my profile (V2):
#{outputs('Get_my_profile_(V2)')?['body']}
Set Schema to:
{
"type": "object",
"properties": {
"##odata.context": {
"type": "string"
},
"##odata.id": {
"type": "string"
},
"employeeId": {
"type": "string"
}
}
}
Create a new step: Respond to a PowerApp or flow
Add an output type Text:
Enter title : EmployeeId
Enter in a value to respond : #body('Parse_JSON')?['employeeId']
Save the Power Automate flow and test it. You will have to approve O365 access permissions. The whole flow should look like this:
Back in Power Apps, Connect your new flow to the app.
Set your Button1.OnSelect to: Set( varEmployeeID, GetEmployeeId.Run())
Create a label with the Label1.Text set to: varEmployeeID.employeeid
Run the app and click the button to test.
I think your scenario requires to use Microsoft Graph to consumes Azure AD User Account objects, that inherits from directoryObject. About this item, recommended to view similar trouble in this topic: Get EmployeeID on Powerapps, that contains an example to parse in parameter an e-mail or an UserPrincipalName and returns the Active Directory employee ID.

Google Smart Home Toggles Trait mysterious utterances

I'm struggling to complete the development for a SmartHome action on our security panels, involving different trait implementations (including ArmDisarm, Power, Thermostats, etc.).
One specific problem is related to Toggles Trait.
I need to accept commands to enable or disable intrusion sensor bypass/exclusion.
I've added to the SYNC response the following block, for instance, for a window sensor in the kitchen:
{
'id': '...some device id...',
'name': {'name': 'Window Sensor'},
'roomHint': 'Kitchen',
'type': 'action.devices.types.SENSOR',
'traits': 'action.devices.traits.Toggles',
'willReportState': true,
'attributes': {
'commandOnlyToggles': false,
'queryOnlyToggles': false,
'availableToggles': [
{
'name': 'bypass',
'name_values': {
{ 'name_synonym': ['bypass', 'bypassed', 'exclusion'}, 'lang': 'en'],
{ 'name_synonym': ['escluso', 'bypass', 'esclusa', 'esclusione'], 'lang': 'it'}
},
}
]
}
}
I was able to trigger the EXECUTE intent by saying
"Turn on bypass on Window Sensor" (although very unnatural).
I was able to trigger the QUERY intent by saying
"Is bypass on Window Sensor?" (even more unnatural).
These two utterances where found somewhere in a remote corner of a blog.
My problem is with Italian language (and also other western EU languages such as French/Spanish/German).
The EXECUTE Intent seems to be triggered by this utterance (I bet no Italian guy will ever say anything like that):
"Attiva escluso su Sensore Finestra"
(in this example the name provided in the SYNC request was translated from "Window Sensor" to "Sensore Finestra" when running in the context of an Italian linked account).
However I was not able to find the utterance for the QUERY request, I've tried everything that could make some sense, but the QUERY intent never gets triggered, and the assistant redirects me to a simple search on the web.
Why is there such a mistery over utterances? The sample English utterances in assistant docs are very limited, and most of the times it's difficult to guess their counterpart in specific languages; furthermore no one from AOG has ever been able to give me any piece of information on this topic.
It's been more than a year now for me, trying to create a reference guide for utterances to be included in our device user manual, but still with no luck.
Can any one of you point me to some reference?
Or is there anything wrong with my SYNC data?
You can file a bug on the public tracker and include the QUERYs you have attempted. Since the execution intents seem to work, it may just be a bug in the backend grammar that isn't triggering.

Errors with multi turn dialog in alexa skills

I have created a skill with name "BuyDog" and its invocation name is "dog app"
So that should mean, I can use the intents defined inside only after the invocation name is heard. (is that correct?)
Then I have defined the Intents with slots as:
"what is {dog} price."
"Tell me the price of {dog}."
where the slot {dog} is of slot type "DogType". I have marked this slot as required to fulfill
Then I have added the endpoint to AWS lambda function where I have used the blueprint code of factskills project in node.js, and done few minor changes just to see the working.
const GET_DOG_PRICE_MESSAGE = "Here's your pricing: ";
const data = [
'You need to pay $2000.',
'You need to pay Rs2000.',
'You need to pay $5000.',
'You need to pay INR 3000.',
];
const handlers = {
//some handlers.......................
'DogIntent': function () {
const factArr = data;
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];
const speechOutput = GET_DOG_PRICE_MESSAGE + randomFact;
}
//some handlers.......................
};
As per the about code I was expecting when
I say: "Alexa open dog app"
It should just be ready to listen to the intent "what is {dog} price." and the other one. Instead it says a random string from the node.js code's data[] array. I was expecting this response after the Intent was spoken as the slot was required for intent to complete.
And when
I say: "open the dog app and Tell me the price of XXXX."
It asks for "which breed" (that is my defined question) But it just works fine and show the pricing
Alexa says: "Here's your pricing: You need to pay $5000."
(or other value from the data array) for any XXXX (i.e. dog or not dog type).
Why is alexa not confirming the word is in slot set or not?
And when
I say: "open the dog bark".
I expected alexa to not understand the question but it gave me a fact about barking. WHY? How did that happen?
Does alexa have a default set of skills? like search google/amazon etc...
I am so confused. Please help me understand what is going on?
Without having your full code to see exactly what is happening and provide code answers, I hope just an explanation for your problems/questions will point you in the right direction.
1. Launching Skill
I say: "Alexa open dog app"
It should just be ready to listen to the intent...
You are expecting Alexa to just listen, but actually, Alexa opens your skill and is expecting you to have a generic welcome response at this point. Alexa will send a Launch Request to your Lambda. This is different from an IntentRequest and so you can determine this by checking request.type. Usually found with:
this.event.request.type === 'LaunchRequest'
I suggest you add some logging to your Lambda, and use CloudWatch to see the incoming request from Alexa:
console.log("ALEXA REQUEST= " + event)
2. Slot Value Recognition
I say: "open the dog app and Tell me the price of XXXX."
Why is alexa not confirming the word is in slot set or not?
Alexa does not limit a slot to the slot values set in the slotType. The values you give the slotType are used as a guide, but other values are also accepted.
It is up to you, in your Lambda Function, to validate those slot values to make sure they are set to a value you accept. There are many ways to do this, so just start by detecting what the slot has been filled with. Usually found with:
this.event.request.intent.slots.{slotName}.value;
If you choose to set up synonyms in the slotType, then Alexa will also provide her recommended slot value resolutions. For example you could inlcude "Rotty" as a synonym for "Rottweiler", and Alexa will fill the slot with "Rotty" but also suggest you to resolve that to "Rottweiler".
var resolutionsArray = this.event.request.intent.slots.{slotName}.resolutions.resolutionsPerAuthority;
Again, use console.log and CloudWatch to view the slot values that Alexa accepts and fills.
3. Purposefully Fail to Launch Skill
I say: "open the dog bark".
I expected alexa to not understand the question but it gave me a fact about barking.
You must be doing this outside of your Skill, where Alexa will take any inputs and try to recognize an enabled skill, or handle with her best guess of default abilities.
Alexa does have default built-in abilities (not skills really) to answer general questions, and just be fun and friendly. You can see what she can do on her own here: Alexa - Things To Try
So my guess is, Alexa figured you were asking something about dog barks, and so provided an answer. You can try to ask her "What is a dog bark" and see if she responds with the exact same as "open the dog bark", just to confirm these suspicions.
To really understand developing an Alexa skill you should spend the time to get very familiar with this documentation:
Alexa Request and Response JSON Formats
You didn't post a lot of your code so it's hard to tell exactly what you meant but usually to handle incomplete events you can have an incomplete even handler like this:
const IncompleteDogsIntentHandler = {
// Occurs when the required slots are not filled
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'DogIntent'
&& handlerInput.requestEnvelope.request.dialogState !== 'COMPLETED'
},
async handle(handlerInput) {
return handlerInput.responseBuilder
.addDelegateDirective(handlerInput.requestEnvelope.request.intent)
.getResponse();
}
you add this handler right above your actual handler usually in the index.js file of your lambda
This might not fix all your issues, but it will help you handle the event when a user doesn't mention a dog.

"locale" information missing in Alexa HouseholdList event request / How to get multi language support in event handler?

I have successfully integrated the Alexa.HousholdListEvents in my node.js AWS lambda based skill. Now I am trying to use language translation as for usual Intents / Requests.
Unfortunately in the HousholdListEvent the "request" does not contain locale information and instead of a translated string I am getting just the identifier repeated when using t(). See example below. I cannot get the locale information from the received event and would have to fall back to english which is blocking me from starting skill the certification process.
If you need further information - feel free to ask. I am more than happy to provide more details if needed.
Any advice? Help is appreciated!
Why do I have no locale information as part of the event?
Why is t() not working as expected (just like for normal intents)?
How could I translate in the event handler based on the origin locale?
My event request:
"request": {
"type": "AlexaHouseholdListEvent.ItemsCreated",
"requestId": "4a3d1715-e9b3-4980-a6eb-e4047ac40907",
"timestamp": "2018-03-12T11:20:13Z",
"eventCreationTime": "2018-03-12T11:20:13Z",
"eventPublishingTime": "2018-03-12T11:20:13Z",
"body": {
"listId": "YW16bjEuYWNjb3VudC5BRVlQT1hTQ0MyNlRQUU5RUzZITExKN0xNUUlBLVNIT1BQSU5HX0lURU0= ",
"listItemIds": [
"fbcd3b22-7954-4c9a-826a-8a7322ffe57c"
]
}
},
My translation usage:
this.t('MY_STRING_IDENTIFIER')
My result (in the ItemsCreated event handler):
MY_STRING_IDENTIFIER
Expected result (as for other requests):
"This is my translated text"

Resources