我正在尝试使用Twilio发送短信通知,但我不能,它只会将通知发送到我添加到通知选项('notificationOpts')的一个号码(我的号码)中,并且总是发生相同的情况。 它仅适用于我的电话号码,不适用于我添加的其他号码。 我不知道我在做什么错。
const accountSid = 'xxxxxxxxxxxxxxxxxx';
const authToken = 'xxxxxxxxxxxxxxxxxx';
const notifyServiceSid = 'xxxxxxxxxxxxxxxxxx';
const client = require('twilio')(accountSid, authToken);
const notificationOpts = {
toBinding: JSON.stringify({
binding_type: 'sms',
address: '+00000',
}),
toBinding: JSON.stringify({
binding_type: 'sms',
address: '+00001',
}),
body: 'HI',
};
client.notify
.services(notifyServiceSid)
.notifications.create(notificationOpts)
.then(notification => console.log(notification.sid))
.catch(error => console.log(error));
答案 0 :(得分:0)
我刚刚尝试了代码,在这里工作正常。您可能仍在使用试用帐户吗? The trial account only allows sending numbers to verified numbers最有可能是您自己的电话号码。