简体   繁体   English

如何使用AWS IOT按钮同时发送短信和通话?

[英]How to send sms and call at a time using aws IOT button?

I am doing a project in AWS IOT button. 我正在使用AWS IOT按钮进行项目。 I have the code for more than one phone number receive these messages while clicking the button (single click, double click, long press) but also need to make receive calls at the same click but I tried using IFTTT to make calls but now I need to integrate the IFTTT with my existing lambda function. 我有多个电话号码的代码,在单击按钮时(单击,双击,长按)会收到这些消息,但同时也需要拨打电话,但是我尝试使用IFTTT拨打电话,但是现在我需要将IFTTT与我现有的lambda函数集成在一起。 I am having the error which says it has different policies and role. 我遇到错误,它说它具有不同的策略和角色。 So how could I make a function which sends SMS and call at a single click? 那么,如何创建一个可以单击发送和调用SMS的功能?

For SMS and Phone call I have two lambda function. 对于短信和电话,我有两个lambda函数。 So I need to invoke a lambda function from another Lambda function. 因此,我需要从另一个Lambda函数中调用一个Lambda函数。

var aws = require('aws-sdk');
var lambda = new aws.Lambda({
  region: 'us-west-2' //change to your region
});

lambda.invoke({
  FunctionName: 'name_of_your_lambda_function',
  Payload: JSON.stringify(event, null, 2) // pass params
}, function(error, data) {
  if (error) {
    context.done('error', error);
  }
  if(data.Payload){
   context.succeed(data.Payload)
  }
});

You can find Doc here http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html 您可以在此处http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Lambda.html找到文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM