Ahmed Bin Mohiuddin
Ahmed Bin Mohiuddin

Reputation: 41

TWILIO cannot send sms from C# console app

I'm having a problem to use TWILIO to send sms from C# console app. Initially I faced an error mentioning "Method not found: 'Void RestSharp.RestClient.set_BaseUrl(System.String)'." After applying solution given in another post the application now runs. However it does not send any sms. After looking at response in another post, I tried using the RestException property and found the following message as exception message "Permission to send an SMS has not been enabled for the region indicated by the 'To' number: +880161xxxxxxx.". So does it mean that Twilio based application cannot work for Bangladesh (+880 country code)? Do you have any plan to update it? However I would like to add mentioning that from the Twilio website I could manage to validate the number(+880161xxxxxxx) by sending verification sms from twilio website.

I tried the following code

using Twilio;

namespace SMSTestApp1
{
class Program
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account 
        string AccountSid = "xxx";
        string AuthToken = "yyy";
        var twilio = new TwilioRestClient(AccountSid, AuthToken);

        var message = twilio.SendMessage("+1205490xxxx", "+8801615xxxxxx", "Test Message", new string[] { }, String.Empty);
        Console.WriteLine(message.Sid);
        if (message.RestException != null)
        {
            Console.WriteLine(message.RestException.Message);
        }
        Console.WriteLine("Finish");
        Console.ReadKey();
    }
}

}

Upvotes: 0

Views: 2066

Answers (1)

Louis Lewis
Louis Lewis

Reputation: 1308

I think you need to log into your Twilio portal, click on the top right where your account name is, and select account from that drop down menu. Once that loads, you can select geographic permissions. You will find a list and you will need to enable the country that you are attempting to send too.

Upvotes: 2

Related Questions