简体   繁体   中英

Studio Flow -> Send Message -> Function (Email)

Looking for some help here. Not a coder by any means and trying to use built in functionality of Twilio to do 2 things. My goal is to respond to any SMS that is received on any of my numbers and then forward the received message to an email distro.

I have easily accomplished both of these separately.

Using a studio flow I setup an auto-responder and then using a function I integrated into SendGrid to send an email of the SMS. But when I try to combine the 2 it keeps failing.

My first approach was to call the function after the send message widget in studio but that errors out. Below is a pic of the flow and the errors.

工作室流程

错误

My second approach was to just add some type of auto-respond section to my send to email function but I am no coder and cannot find any examples of anyone else doing it this way. I am just using the auto-deployed code for twilio and sendgrid integration for this function but code is below.

发送到电子邮件代码

Any ideas??

Thanks, Drew

Twilio developer evangelist here.

It's hard to tell, but my guess here is that you have not passed the necessary data from the Studio Flow to the Function. The Function code you have there expects the event object to have a From and Body parameter, which is normally passed to it by the incoming SMS webhook .

When you use the Function as a widget in Studio, you need to pass those bits of data yourself. In this case, you should pass a parameter called Body with the value {{trigger.message.Body}} and a parameter of From with the value {{trigger.message.From}} , like this:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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