从AWS Lambda触发Alexa技能 [英] Trigger Alexa Skill From AWS Lambda

查看:222
本文介绍了从AWS Lambda触发Alexa技能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了一些AWS Lambda文档,我看到我们可以将触发器(Alexa Skill Kit)附加到lambda函数,一旦调用该技能,lambda函数就会被触发. (有人致电Alexa和Lambda被触发)

I have gone through some of the documentation of AWS Lambda, I see we can attach a trigger(Alexa Skill Kit) to lambda function and lambda function will be triggered once the skill gets invoked. (Someone Calls Alexa and Lambda gets triggered)

但是我想反之亦然,例如 我应该能够从AWS Lambda函数调用技能集,就像我编写AWS Lambda函数一样,并且应该能够调用以调用我已经发布的Alexa技能. (Lambda从我的应用程序中触发,并调用技能集.)

But i want vice-versa of this, like I should be able to invoke a skill set from AWS Lambda function, like i write a AWS lambda function and should be able to make a call to invoke that Alexa skill which i have published. (Lambda gets triggered from my Application and that invokes a Skill Set).

推荐答案

从技术上讲,您不能从Alex设备上的任何地方调用"Alexa Skill".即您无法使您的技能开始向客户发送语音提示. Alexa流程总是相反:客户向Alexa提出问题,您的技能被调用,Alexa向客户提供语音响应.

Technically you can not invoke a 'Alexa Skill' from anywhere but from an Alex device. i.e. you can not cause your skill to start sending voice prompts to customers. The Alexa flow is always the other way around : customer asks something to Alexa, your skill is invoked and Alexa delivers the voice response to customer.

您可以将Alexa通知发送给授权它的客户.例如,您的技能可以通知订单已准备就绪或已交付,而不会被客户问题触发.请参阅Alexa Proactive Events API文档以检查如何实施此操作: https://developer.amazon.com/blogs/alexa/post/7822f3ee-1735-4eaa-9aa6-5b8e39953c07/proactiveeventsapi-launch-announcement

You can send Alexa notifications to customers that authorized it. For example your skill can inform an order is ready or being delivered without being triggered by a customer question. See Alexa Proactive Events API documentation to check how to implement this : https://developer.amazon.com/blogs/alexa/post/7822f3ee-1735-4eaa-9aa6-5b8e39953c07/proactiveeventsapi-launch-announcement

这就是说,由于您的Alexa技能是通过AWS Lambda函数实现的,因此您可以编写代码以在Alexa上下文之外调用该函数.这将允许另一个应用程序调用与您的Alexa技能相同的代码,但是您将无法通过此方法向您的客户发送语音消息,因为调用将不在任何Alexa会话中进行.

That being said, as your Alexa skill is implemented by an AWS Lambda function, you can write code to invoke that function outside of the Alexa context. This would allow another app to invoke the same code as your Alexa Skill, but you won't be able to send a voice message by to your customers by doing so, as the invocation will be out of any Alexa session.

要触发Lambda函数,您有多个选项.您可以通过编程方式或通过使用调用 API href ="https://docs.aws.amazon.com/cli/latest/reference/lambda/invoke.html" rel ="nofollow noreferrer"> AWS命令行.您还可以通过 API网关(REST)或 AppSync (GraphQL)

To trigger a Lambda function, you have multiple options. You can use the Invoke API programmatically or through the AWS command line. You can also expose your Lambda function through an API Gateway (REST) or AppSync (GraphQL)

这篇关于从AWS Lambda触发Alexa技能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆