twilio callbackurl 使用 SendMessage 方法调用但不使用 SendSmsMessage 方法调用 [英] twilio callbackurl called with SendMessage method but not with SendSmsMessage method

查看:20
本文介绍了twilio callbackurl 使用 SendMessage 方法调用但不使用 SendSmsMessage 方法调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 twilio 付费帐户发送短信.我还配置了一个回调,以便在将消息传递给客户端时在我的应用程序中进行一些状态更新.我遇到的一个奇怪的行为是,当我使用 SendSmsMessage 发送消息时(因为它是一条简单的 sms 消息),尽管消息已发送到移动设备,但没有调用 callbackurl,但是当我使用 SendMessage 方法向我发送消息时,Callbackurl 正在工作很好,状态也更改为在 twilio 仪表板上交付.我的代码是

I am using twilio paid account for sending sms messaging. I have also configured a callback to do some status update in my application when message is delivered to client. One odd behavior i am having is that when I am sending message with SendSmsMessage (as it is a simple sms message) then though message is delivered to the mobile but callbackurl is not called but when I am sending me message with SendMessage method Callbackurl is working fine and status also changed to delivered on twilio dashboard. My code is

  string AccountSid = "************************";
                string AuthToken = "**********************************";
                var twilioClient = new TwilioRestClient(AccountSid, AuthToken);
                var twiliopaidnumber = "+15334455923";
                var message = twilioClient.SendSmsMessage(twiliopaidnumber , "+923338432293", " TestMesage ", "http://mytestcallback/TwilioResponseHandler.ashx");
                //var message = twilioClient.SendMessage(twiliopaidnumber , "+923338432293", " TestMesage ", "http://mytestcallback/TwilioResponseHandler.ashx");

有人也遇到过这个问题吗?

Does anybody also have experience this issue?

推荐答案

Twilio 开发人员布道者在这里.SMS 端点 在 API 中已弃用,并且响应方式与较新的资源.您正在调用的 SendSmsMessage 方法使用的是旧端点,而 SendMessage 使用的是新的 消息资源,其行为与您预期的一样.

Twilio developer evangelist here. The SMS endpoint is deprecated in the API and doesn't respond the same way as newer resources. The SendSmsMessage method you are calling is using that old endpoint and SendMessage is using the new Messages resource which behaves as you're expecting.

我建议在需要发送消息的任何地方使用 SendMessage.

I recommend using SendMessage everywhere that you need message sending.

这篇关于twilio callbackurl 使用 SendMessage 方法调用但不使用 SendSmsMessage 方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆