简体   繁体   English

如何使用 Twilio 短信发送自定义参数

[英]How to send custom parameters with Twilio SMS

Can someone tell me if it'spossible to send custom parameters when sending a SMS with Twilio API?有人可以告诉我在使用 Twilio API 发送短信时是否可以发送自定义参数?

I'm sending SMS like this:我正在发送这样的短信:

  var options = new CreateMessageOptions(smsToSend.PhoneNumber)
                        {
                            Body = message,
                            From = new PhoneNumber(twilioNumber),
                            ProvideFeedback = true,
                            StatusCallback = new Uri(callBackUri)
                        };
                        MessageResource.Create(options);

When the SMS is sent, Twilio send a callback to my application controller:发送 SMS 时,Twilio 向我的应用程序 controller 发送回调:

 [HttpPost]
        [AllowAnonymous]
        public TwiMLResult MessageReceive(SmsRequest request)
        {
            //Some business here
            return TwiML(new MessagingResponse());
        }

Problem is, I need to retrieve a custom Id parameter to make different business treatments.问题是,我需要检索一个自定义Id参数来进行不同的业务处理。 Is there a way, when sending the SMS, to pass custom parameters that would be sent back in the Twilio's callback?有没有办法在发送 SMS 时传递将在 Twilio 的回调中发回的自定义参数?

There isn't a way to set any custom values, that is called out below.无法设置任何自定义值,如下所述。 Each outbound SMS is assigned a unique Messaging SID which you could use to keep track of messages.每个出站 SMS 都分配有一个唯一的消息 SID,您可以使用它来跟踪消息。

You can append a URL Query Parameter key/value to your statusCallback URL, which will be sent to your application and could be used for that purpose.您可以 append 和 URL 查询参数键/值到您的 statusCallback URL,这将被发送到您的应用程序并可以用于该目的。

Best Practices for SMS Message Logging SMS 消息记录的最佳实践

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM