Search code examples
asp.netmodel-view-controllerasp.net-identitytwilio

I am having an issu with sending message


this is the problem , please help to find me a way to use send message function

https://i.sstatic.net/O0lBk.png


Solution

  • Twilio developer evangelist here.

    Looks like you might have the latest version of the C# library installed there, but you're trying to use the code for the previous version.

    I recommend you check out the documentation for sending messages with C#.

    The example for using C# looks like this:

    using System;
    using Twilio;
    using Twilio.Rest.Api.V2010.Account;
    using Twilio.Types;
    using System.Collections.Generic;
    
    class Example
    {
       static void Main(string[] args)
       {
            const string accountSid = "YOUR_ACCOUNT_SID";
            const string authToken = "YOUR_AUTH_TOKEN";
            TwilioClient.Init(accountSid, authToken);
    
            var to = new PhoneNumber(PHONE_NUMBER);
            var message = MessageResource.Create(
                to,
                from: new PhoneNumber(TWILIO_NUMBER),
                body: "Hello world!",
                mediaUrl: mediaUrl);
            Console.WriteLine(message.Sid);
       }
    }
    

    Let me know if that helps at all.