Twilio开发者布道者。
正如我们在你的另一个问题中讨论的那样,
<Sms>
我建议使用
Messages resource of the REST API to send messages
相反你不能用TwiML垃圾箱,但你可以用
Twilio Functions
.
config section for Functions
确保选中“启用帐户SID和身份验证令牌”复选框。
Create a new Function in your Twilio console
并输入以下代码(替换实数的占位符):
exports.handler = function(context, event, callback) {
const client = context.getTwilioClient();
const message1 = client.messages.create({
from: YOUR_TWILIO_NUMBER,
to: event.From,
body: `Here's the recording of your call: ${event.RecordingUrl}`
});
const message2 = client.messages.create({
from: YOUR_TWILIO_NUMBER,
to: THAT_OTHER_NUMBER,
body: `Call recorded from ${event.From} to ${event.To}.`
})
Promise.all([message1, message2]).then(() => {
let twiml = new Twilio.twiml.VoiceResponse();
callback(null, twiml);
}, err => {
callback(err);
})
};
<Dial>
在你的第一个TwiML垃圾桶里。