Nexmo - Select 从基于目的地位置的号码到号码

Nexmo - Select from number based on location of destination to number

在 Twilio 中有一个 phone # 池的概念。可以使用此 Pools Id 值发送 txt 消息,Twilio 将 select 发送的最佳发件人号码。我查看了 Nexmos API,但没有看到类似的功能,这可能吗?

我发现的唯一其他选项是调用 applications 但我无法发送消息,除非手动 selecting 来自号码而不是通过应用程序 ID 自动发送消息,我假设将是 'use cases'

之一

Nexmo https://help.nexmo.com/hc/en-us/articles/217571017-What-is-a-Sender-ID- 的一份文档包含以下内容

Random Numeric - Nexmo will apply a random number to comply with local regulations (usually taken from a pool of numbers we have access to from the relevant destination market).

问题是如何配置随机数字?它并没有真正解释,我可能错过了那些文档。任何建议帮助。

随机数字不是您设置的,而是 Nexmo API 所做的,以确保在世界某些地区交付,以符合当地法规。

目前 Nexmo 中没有 Pools 概念,因此如果您想要相同的功能,则必须在您的代码中构建它。租用一堆 Nexmo phone 号码,然后在将每条消息发送到 select 您的 phone 号码之前,在您的代码中应用随机选择算法。类似于:

let myNexmoNumbers = [447481234567, 447481234568, 447481234569]

nexmo.message.sendSms(myNexmoNumbers[Math.floor(Math.random() * myNexmoNumbers.length)], TO_NUMBER, TEXT_MESAGE, (err, responseData) => {
    if (err) {
        console.log(err);
    } else {
        if(responseData.messages[0]['status'] === "0") {
            console.log("Message sent successfully.");
        } else {
            console.log(`Message failed with error: ${responseData.messages[0]['error-text']}`);
        }
    }
})