问题
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