twilio callbackurl called with SendMessage method but not with SendSmsMessage method

喜夏-厌秋 提交于 2019-12-20 06:21:29

问题


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?


回答1:


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.

I recommend using SendMessage everywhere that you need message sending.




回答2:


SendMessage is the newer API call, I went thru this exact issue a few weeks ago, complicated by a few bugs :) -- see this post



来源:https://stackoverflow.com/questions/29467402/twilio-callbackurl-called-with-sendmessage-method-but-not-with-sendsmsmessage-me

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!