StatusCallback does not work as expected

Overview:

I am working on a VB.NET application that puts a call to Twilio, the number is not a test number. I am using C # library with code written in VB.Net.

When I use this line of code: Console.WriteLine (account.SendSmsMessage (Caller, to1, strBody))

I receive a text message on my phone, however, no mail is ever sent to my site. I have included the site URL in my account under Messages> Request URL. When I reply to a post, Twilio makes a post on my site. As far as I understand, the POST should have been done when Twilio was first sent a message from my application, however it is not.

When using this code, I don't get a text message and no POST is generated. Console.WriteLine (account.SendMessage (Caller, to1, strBody, PostBackURL))

I tried SendSMSMessage, I tried it with and without url in my account, nothing affects the behavior.

I need SmsMessageSid while sending a message. From everything I've seen Twilio provides no answer other than what is posted in PostBackURL, I could parse the answer for SmsMessageSid, however since there is no answer, this is not an option. If I'm wrong on this question that would be great, however it looks like the only way to get an answer is from the backlink URL. Thank you for your help! Below you will find an excerpt from the code I am working with:

    PostBackURL = "http%3A%2F%2F173.111.111.110%3A8001/XMLResponse.aspx"

    ' Create Twilio REST account object using Twilio account ID and token
    account = New Twilio.TwilioRestClient(SID, Token)
    message = New Twilio.Message

    Try   
         'WORKS
        'Console.WriteLine(account.SendSmsMessage(Caller, to1, strBody))  
         'DOES NOT WORK
        Console.WriteLine(account.SendMessage(Caller, to1, strBody, PostBackURL))

    Catch e As Exception
        Console.WriteLine("An error occurred: {0}", e.Message)
    End Try
    Console.WriteLine("Press any key to continue")
    Console.ReadKey()

      

+3


source to share


1 answer


I am doing something similar with C # and like you I am not getting POST to the callback url. I don't know why this doesn't work, but if all you want is sid when you post, you should do this:

    message = SendSmsMessage(Caller, to1, strBody))

      



and message.Sid will give you what you need without allowing any exceptions.

0


source







All Articles