I've updated my Twilio library to latest and now SendMessage
no longer resolves.
client.SendMessage("YOUR_TWILIO_NUMBER", "YOUR_NUMBER", "Ahoy from Twilio!");
How do I send a text with the current C# Twilio libarary?
Twilio developer evangelist here.
Sounds like you've updated from version 4 to version 5 of the Twilio C# library. This was an update with breaking changes and there is a full upgrade document available here.
For sending messages you need to update to use the new MessageResource
. Here's an example:
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
using System.Collections.Generic;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "your_account_sid";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+15017250604");
var message = MessageResource.Create(
to,
from: new PhoneNumber("+15558675309"),
body: "This is the ship that made the Kessel Run in fourteen parsecs?");
Console.WriteLine(message.Sid);
}
}
Let me know if that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With