我无法使用nodejs sdk从twilio API从美国号码向阿联酋号码发送消息

问题描述 投票:0回答:1

我无法从美国 twilio 号码向阿联酋 twilio 号码发送短信。 此外,在地理设置中,还启用了向阿联酋号码发送短信。

我在这里粘贴代码:

const accountSid = '<account-sid>';
const authToken = '<auth-token>';
const client = require('twilio')(accountSid, authToken);

client.m
  .create({
     body: 'This is the ship that made the Kessel Run in fourteen parsecs?',
     from: '<us-number>', // example: +12345678901  country code is +1
      to: '<uae-number>' // example: '+971123456789' country code is +971 (also i tried different uae numbers, didn't work)
   })
  .then(message => console.log(message.sid)).catch(error => console.log(error.message));

我收到错误文本:

Message cannot be sent with the current combination of 'To' (+97112345XXXX) and/or 'From' (+12345678901) parameters

但是,如果我使用相同的

from
to
参数点击 twilio 语音通话 api,它就会像魅力一样工作。请参阅下面的示例:

   client.calls
   .create({
     twiml: '<Response><Say>Hello, this is a test voice call from Twilio.</Say></Response>',
     from: '<us-number>', // same us number
     to: '<uae-number>',  // same uae number,
   })
   .then(call => console.log(`Call SID: ${call.sid}`))
   .catch(error => console.error(`Error making voice call: ${error.message}`)); 

它将成功返回一个呼叫sid。

我非常不知道这里的消息有什么问题,那里有人遇到类似的问题,同时我已向 twilio 发送支持并等待他们的回复几个小时!

node.js twilio sms voice
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.