Bcf Ant
Bcf Ant

Reputation: 1759

Create trigger for Lambda function using Boto3

How do I create an Alexa trigger for a Lambda function using boto3 in Python?

Upvotes: 4

Views: 5852

Answers (2)

declension
declension

Reputation: 4185

To update the accepted answer a bit (mid-2018):

Nowadays, for Skill ID Verification, you can add an EventSourceToken parameter (see boto3 docs on add_permission())

function_name = 'foo'
skill_id ='amzn1.ask.skill.xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
response = client.add_permission(
    FunctionName=function_name,
    StatementId='AlexaFunctionPermission',
    Action='lambda:InvokeFunction',
    Principal='alexa-appkit.amazon.com',
    EventSourceToken=skill_id)

See the official reference (CLI-based).

Hope that helps someone.

Upvotes: 2

Bcf Ant
Bcf Ant

Reputation: 1759

For anyone who may not know how.

response = client.add_permission(
    FunctionName='<YOUR_FUNCTION_NAME>',
    StatementId='AlexaFunctionPermission',
    Action='lambda:InvokeFunction',
    Principal='alexa-appkit.amazon.com',)

Upvotes: 2

Related Questions