【问题标题】:How can I send notifications to multiple numbers with Twilio?如何使用 Twilio 向多个号码发送通知?
【发布时间】:2019-04-21 22:14:44
【问题描述】:

我正在尝试使用 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));

【问题讨论】:

    标签: node.js twilio twilio-api twilio-programmable-chat twilio-functions


    【解决方案1】:

    我刚刚尝试了代码,它在这里工作正常。您可能还在试用帐户上吗? The trial account only allows sending numbers to verified numbers 很可能是您自己的电话号码。

    【讨论】:

    • 这是问题所在。感谢您的回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-09
    • 2020-11-30
    • 1970-01-01
    相关资源
    最近更新 更多