Example #1
1
        public ActionResult GetMessages()
        {
            var twilio = new TwilioRestClient(AccountSid, AuthToken);

              // Build the parameters
             	  var options = new MessageListRequest();

              var ListMessagesResponse = twilio.ListMessages(options);

              return View(ListMessagesResponse);
        }
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        string AuthToken = "your_auth_token";
        var twilio = new TwilioRestClient(AccountSid, AuthToken);

        var request = new MessageListRequest();

        var messages = twilio.ListMessages(request);

        foreach (var message in messages.Messages)
        {
          Console.WriteLine(message.Body);
        }
    }
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        string AuthToken = "your_auth_token";
        var twilio = new TwilioRestClient(AccountSid, AuthToken);

        var request = new MessageListRequest
        {
          To = "+15558675309",
          From = "+15017250604",
          DateSent = new DateTime(2016, 8, 31),
          DateSentComparison = ComparisonType.GreaterThanOrEqualTo
        };

        var messages = twilio.ListMessages(request);

        foreach (var message in messages.Messages)
        {
          Console.WriteLine(message.Body);
        }
    }
Example #4
0
        //method to get sms from Twilio
        public static string GetSms()
        {

             var twilio = new TwilioRestClient(accountSid, authToken);

            // Build the parameters 
            var options = new MessageListRequest();
            List<string> msg = new List<string>();

            var messages = twilio.ListMessages(options);
            foreach (var message in messages.Messages)
            {
               
                if (message.To == twilioPhoneNumber)
                {
                    msg.Add(message.Body);
                }
            }

            //Get the last sms
            string smsInput = msg[0];
         
            return smsInput;
        }