9

This is the error I am getting while trying to send the message.

An unhandled exception of type 'Twilio.Exceptions.ApiException' occurred in Twilio.dll
Additional information: Upgrade Required

My code is:

const string accountSid = "Value";
const string authToken = "Value";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+whatsapp:+13233633791");
var message = MessageResource.Create(
    to,
    from: new PhoneNumber("+whatsapp:+12037179461"),
    body: "Hi Joe! Your order D45987AB will arrive on 8/12/2018 before 8 pm.");
    Console.WriteLine(message.Sid);
kalehmann
  • 4,821
  • 6
  • 26
  • 36
learner
  • 91
  • 1
  • 1
  • 3
  • See the answers to this question: https://stackoverflow.com/questions/55428324/twilio-rest-client-stops-working-after-adding-studio-flow#comment97585161_55428324 – Alex Baban Apr 05 '19 at 07:29

3 Answers3

21

Per their docs, Twilio APIs now requires TLS v1.2 and string cipher suites.

Inside your method, before MessageResource.Create() is invoked, add

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                                                | SecurityProtocolType.Tls11
                                                | SecurityProtocolType.Tls12
                                                | SecurityProtocolType.Ssl3;
SteveSeow
  • 295
  • 1
  • 3
9

I was able to resolve this by setting :

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; //TLS 1.2

in the start of my application.

You Can Also Read this github link issues: https://github.com/twilio/twilio-csharp/issues/472

Fahim Akhtar
  • 359
  • 1
  • 4
  • 13
0

I upgraded the .Netframework to 4.7.1 of my application. and its working now