I’m trying to configure a lambda function to be triggered by a Lex intent. I see support for Alexa Skill triggers, but not Lex. Is this supported, or is it possible to define custom triggers using cloudformation?
This is the relevant section, edited account information and changed function names
GetExampleFunction:
handler: handler.getExampleFunction
description: "example func"
environment:
DEPLOYMENT: ${opt:stage}
events:
- ???
And here is the permissions function policy after manually adding the lex trigger through the aws cli
{
"Version": "2012-10-17",
"Id": "default",
"Statement": [
{
"Sid": "centene-dev-GetExampleFunctionLambdaPermissionApiGateway-*********",
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
},
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:us-east-1:******************:function:dev-GetExampleFunction",
"Condition": {
"ArnLike": {
"AWS:SourceArn": "arn:aws:execute-api:us-east-1:*************:*********/*/*"
}
}
},
{
"Sid": "lex-us-east-1-exampleIntent",
"Effect": "Allow",
"Principal": {
"Service": "lex.amazonaws.com"
},
"Action": "lambda:invokeFunction",
"Resource": "arn:aws:lambda:us-east-1:*************:function:dev-GetExampleFunction",
"Condition": {
"ArnLike": {
"AWS:SourceArn": "arn:aws:lex:us-east-1:**********:intent:exampleIntent:*"
}
}
}
]
}
Thanks!