【问题标题】:How can i send the bulk sms through twilio?如何通过 twilio 发送群发短信?
【发布时间】:2020-04-30 12:07:41
【问题描述】:

var notification = NotificationResource.Create( 服务标识, toBinding: 新列表 { "{\"binding_type\":\"sms\",\"address\":\"+1651000000000\"}"} body: "Knok-Knok!这是你的第一条通知短信");

我的问题是我将如何在 toBinding 参数中发送数据。

帮帮我

【问题讨论】:

  • 这个页面有一个C#代码示例(右上角),Send a Notification to Bindings in the request - twilio.com/docs/notify/api/notification-resource
  • 你好 Alan 其实我想知道,如何将联系人列表发送到 Notification API 的绑定参数中?

标签: c# asp.net twilio


【解决方案1】:

我使用 JS/Node(很遗憾我没有 C# 示例)。我使用下面的技术取得了成功。也许您可以根据您的需求进行逆向工程。

const fetch = require('node-fetch');

const params = new URLSearchParams();
params.append('Body', 'Hello from Node-Fetch!!!');
params.append('ToBinding', '{ "binding_type": "sms", "address": "+14075551212" }');
params.append('ToBinding', '{ "binding_type": "sms", "address": "+18025551212" }');

let headers = {Authorization: 'Basic ' + new Buffer.from(process.env.TWILIO_ACCOUNT_SID + ":" + process.env.TWILIO_AUTH_TOKEN).toString("base64")};

console.log(`To String Output: ${params.toString()}`);

fetch('https://notify.twilio.com/v1/Services/IS076575aa3098c700a174ad0123456789/Notifications',
    {method: 'POST', headers: headers, body: params})
    .then(res => res.json())
    .then(json => console.log(json))
    .catch(err => console.log(err))

【讨论】:

  • 实际上我在发送请求时收到以下错误(无法将传入参数转换为通知对象:参数'ToBinding'无效)
  • 如何在 c# "{\"binding_type\":\"sms\",\"address\":\"+91123456789\"}", "{\" 中实现这样的精确格式binding_type\":\"sms\",\"address\":\"+91123456789\"}"
  • 我不知道,因为我不是 C# 开发人员,还有其他人有意见吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-01
  • 2012-04-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多