Twilio不提供电子邮件记录的原生方式,因此需要对此进行编码。在本例中,用户呼叫的语音信箱已被接收。现在我们已经有了录音,创建了一个Twilio函数(NodeJS)来将录音发送到电子邮件。
在下面的示例代码中,函数失败了,但是Twilio控制台中没有可用的调试工具来处理函数。NodeJS对我们来说是相当新的,所以这可能很容易被人发现。
不过,可能出现的其他错误可能是:
输入变量是:
附件{{widgets.Voicemail_Recording.RecordingUrl}-它包含语音邮件记录的网址。
lang --调用者的语言(基于先前的IVR选择)。
phone_number {trigger.call.From}
NodeJS二次函数
var mailer = require('nodemailer');
mailer.SMTP = {
host: 'smtp.gmail.com',
port:587,
use_authentication: true,
user: 'info@example.com',
pass: '*********'
};
exports.handler = function(context, event, callback) {
mailer.send_mail({
sender: event.phone_number + '<info@example.com>',
to: 'info@example.com',
subject: 'Voicemail (' + event.lang + ')',
body: 'mail content...',
attachments: [{'filename': event.attachment, 'content': data}]
}), function(err, success) {
if (err) {
}
}
};发布于 2020-04-27 17:29:55
Sam来自Twilio的支持团队--我刚刚发布了一篇博客文章,应该会对此有所帮助。它展示了如何使用Studio、Functions和SendGrid转发语音邮件。看看这里:https://www.twilio.com/blog/forward-voicemail-recordings-to-email
https://stackoverflow.com/questions/53229625
复制相似问题