当前位置: 首页>>代码示例>>C#>>正文


C# TwilioRestClient.SendSmsMessage方法代码示例

本文整理汇总了C#中Twilio.TwilioRestClient.SendSmsMessage方法的典型用法代码示例。如果您正苦于以下问题:C# TwilioRestClient.SendSmsMessage方法的具体用法?C# TwilioRestClient.SendSmsMessage怎么用?C# TwilioRestClient.SendSmsMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Twilio.TwilioRestClient的用法示例。


在下文中一共展示了TwilioRestClient.SendSmsMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendSms

		/// <summary>
		/// Send an SMS message
		/// </summary>
		/// <param name="from">The number to send the message from</param>
		/// <param name="to">The number to send the message to</param>
		/// <param name="body">The contents of the message, up to 160 characters</param>
		/// <param name="statusCallbackUrl">The URL to notify of the message status</param>
		/// <returns>An SMSMessage Instance resource</returns>
		public static SMSMessage SendSms(string from, string to, string body, string statusCallbackUrl)
		{
			CheckForCredentials();

			var twilio = new TwilioRestClient(AccountSid, AuthToken);
			return twilio.SendSmsMessage(from, to, body, statusCallbackUrl);	
		}
开发者ID:vmhung93,项目名称:twilio-csharp,代码行数:15,代码来源:Twilio.cs

示例2: SendPassButton_Click

    protected void SendPassButton_Click(object sender, EventArgs e)
    {

        string MyNum = "16093850962";
        string AcctID = "ACfe8686a211342fd1e55bb6654995c77f";
        string AuthTok = "197a4597c18dff5f22208f12151e2d64";

        TwilioRestClient clnt = new TwilioRestClient(AcctID, AuthTok); 

       clnt.SendSmsMessage(MyNum, ForgotTextBox.Text, "Yo What up");

        SqlConnection cont = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionString);
        SqlCommand comm = new SqlCommand(@"Select Password from LoginTable where [email protected]", cont);



        comm.Parameters.AddWithValue("@CellPhone", ForgotTextBox.Text);
        

        cont.Open();

        SqlDataReader DR = comm.ExecuteReader();
        //Response.Write(DR["Password"].ToString());


    }
开发者ID:pandyav,项目名称:pizzaApp-and-JobPortal,代码行数:26,代码来源:ForgotPass.aspx.cs

示例3: SendSMS

        public TwilioSMSMessage SendSMS(string fromNumber, string toNumber, string text)
        {
            var twilio = new TwilioRestClient(SID, AuthToken);

            try
            {
                var response = twilio.SendSmsMessage(fromNumber, toNumber, text);

                if (response != null)
                {
                    var message = new TwilioSMSMessage();

                    if (response.RestException != null)
                    {
                        message.ErrorCode = response.RestException.Code;
                        message.ErrorMessage = response.RestException.Message;
                    }
                    else
                        message.InjectFrom(response);

                    return message;
                }
            }
            catch(Exception ex)
            {
                throw ex;
            }

            return null;
        }
开发者ID:tonymishler,项目名称:ComputeMidwest,代码行数:30,代码来源:TwilioHelper.cs

示例4: SendMessage

        private bool SendMessage(string toNumber,string textMsg)
        {
            try
            {
                string AccountSid = "AC04b7185526614dcdfcd8e03e0a5842a2";
                string AuthToken = "976054e44e21b91c4af357f770f325fc";
                var twilio = new TwilioRestClient(AccountSid, AuthToken);

                SMSMessage result = twilio.SendSmsMessage("+16782937535", toNumber, textMsg);

                if (result.RestException != null)
                {
                    //an exception occurred making the REST call
                    string message = result.RestException.Message;
                }

                return true;
            }
            catch (Exception)
            {
                return false;

            }
            // Find your Account Sid and Auth Token at twilio.com/user/account
        }
开发者ID:shturner20,项目名称:EContact,代码行数:25,代码来源:MessageController.cs

示例5: SendMessage

 public void SendMessage(Reminder reminder)
 {
     reminder._mobileNumber = FormatNumber(reminder._mobileNumber);
     var client = new TwilioRestClient(AccountSid, AuthToken);
     var smsMessage = client.SendSmsMessage(From, reminder._mobileNumber, reminder._message);
     LogTextResponse(smsMessage, reminder);
 }
开发者ID:tswann,项目名称:remindr,代码行数:7,代码来源:TextService.cs

示例6: Execute

        public override void Execute()
        {
            var sid = EnvironmentVariableHelper.GetEnvironmentVariable(sidKey);
              var token = EnvironmentVariableHelper.GetEnvironmentVariable(tokenKey);
              var number = EnvironmentVariableHelper.GetEnvironmentVariable(numberKey);

              var client = new TwilioRestClient (sid, token);

              foreach (var reminder in In.DueReminders)
              {
            var contact = "+" + reminder.Contact;
            var result = client.SendSmsMessage(number, contact, reminder.Message);
            var error = result.RestException;
            if (error == null) {
              Out.Sent++;
            } else {
              Out.Errors++;
              Console.WriteLine(
            "SMS to {0} failed with a status of {1} and reason of {2}.",
            reminder.Contact,
            error.Status,
            error.Code + ": " + error.Message
              );
            }
              }
        }
开发者ID:schlos,项目名称:denver-schedules-api,代码行数:26,代码来源:SendSMS.cs

示例7: Index

        //
        // GET: /Subscription/
        public ActionResult Index(string From, string To, string Body)
        {
            TwilioRestClient twilio;
            SMSMessage text;

            PhoneNumberUtil phoneUtil = PhoneNumberUtil.GetInstance();
            string oldFrom = From;

            try
            {
                From = phoneUtil.Parse(Body, "US").NationalNumber.ToString();

                twilio = new TwilioRestClient("accountSid", "authToken");
                text = twilio.SendSmsMessage("+YOURTWILIONUMBER", oldFrom, "You're so thoughtful. Steve will call your friend soon!");
            }
            catch (NumberParseException e)
            {

            }

            string storageConnectionString = "DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=ACCOUNTKEY";

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            CloudQueue queue = queueClient.GetQueueReference("messages");
            queue.CreateIfNotExist();
            CloudQueueMessage message = new CloudQueueMessage(From);
            queue.AddMessage(message, new TimeSpan(1, 0, 0), new TimeSpan(0, 1, 0));

            twilio = new TwilioRestClient("accountSid", "authToken");
            text = twilio.SendSmsMessage("+YOURTWILIONUMBER", From, "Sorry you're not feeling well. You'll soon hear from Steve! If you want Steve to call a friend just send their number!");

            return View();
        }
开发者ID:yeahren,项目名称:FlatteristSMS,代码行数:36,代码来源:SubscriptionController.cs

示例8: SendTextMessage

 static void SendTextMessage(string text)
 {
     string AccountSid = REMOVED_KEY;
     string AuthToken = REMOVED_TOKEN;
     var twilio = new TwilioRestClient(AccountSid, AuthToken);
     var message = twilio.SendSmsMessage("+14155085433", REMOVED_PHONE_NUMBER_TO, text, "");
 }
开发者ID:BradRuderman,项目名称:RainNotice,代码行数:7,代码来源:Program.cs

示例9: SendTextMessage

 public static void SendTextMessage(string message)
 {
     TwilioRestClient twilioClient = new TwilioRestClient
         (ConfigurationManager.AppSettings["TwilioAcccountSid"], ConfigurationManager.AppSettings["TwilioAuthToken"]);
     twilioClient.SendSmsMessage(ConfigurationManager.AppSettings["TwilioSenderPhone"],
         ConfigurationManager.AppSettings["TwilioReceiverPhone"], message);
 }
开发者ID:keyvan,项目名称:MiniHawraman,代码行数:7,代码来源:SmsManager.cs

示例10: Index

        public ActionResult Index(string message)
        {
            var twilioClient = new TwilioRestClient(_twilioSID, _twilioAuthToken);

            twilioClient.SendSmsMessage(_twilioSandBoxNumber, "+18168041829", String.Format("{0} {1}", _twilioSandBoxPIN, message));

            return RedirectToAction("Index");
        }
开发者ID:lanceharper,项目名称:TwilioBox-,代码行数:8,代码来源:SmsController.cs

示例11: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            string AccountSid = "ACb25335d26115f43726abc6d3bea6136d";
            string AuthToken = "29770f6ceb3067fba37e9a443f7c8ea2";

            var twilio = new TwilioRestClient(AccountSid, AuthToken);
            var message = twilio.SendSmsMessage("+13479835347", "+995571828588", "Jenny please?! I love you <3", "");
           
        }
开发者ID:d-kakhiani,项目名称:C_Sharp,代码行数:9,代码来源:Form1.cs

示例12: Send

        public void Send(string message, string phoneNumber)
        {
            var twilio = new TwilioRestClient("AC654fe8d243f96cb77397f0f280ab504f"
                                               , "f86acec80f8bea5ff10db08837804f80");

            twilio.SendSmsMessage(_twilioNumber
                                    , phoneNumber
                                    , message);
        }
开发者ID:kmoormann,项目名称:Scarlett.IIM.Texting,代码行数:9,代码来源:Broadcaster.cs

示例13: SendSMS

        public void SendSMS(string targetNumber, string message)
        {
            string twilioNumber = "+18014299303";
            string accountSid = "AC2cbe631411b305e102ac2e3ce2da0407";
            string authToken = "9093223b161f8d4a9a97577b5cddbc20";

            var client = new TwilioRestClient(accountSid, authToken);

            client.SendSmsMessage(twilioNumber, targetNumber, message);
        }
开发者ID:DragonRider0o0,项目名称:HackGT,代码行数:10,代码来源:PhoneController.cs

示例14: GetSendSMS

        public string GetSendSMS()
        {
            string AccountSid = "AC250c475896904f3249306f633df6d114";
            string AuthToken = "ed3be1bdddedf301c711c4ee33f0e185";
            var twilio = new TwilioRestClient(AccountSid, AuthToken);

            var message = twilio.SendSmsMessage("+18179622556", "+18179466874", "Sunny please?! I love you <3", "");
            ViewBag.msg = message.Sid;

            return "sucess";
        }
开发者ID:samarbasnet,项目名称:RoundKit,代码行数:11,代码来源:HomeController.cs

示例15: broadcast

        public ActionResult broadcast(string message)
        {
            var all = Demo.GetAll();

            foreach (var user in all)
            {
                TwilioRestClient t = new TwilioRestClient(Constants.SID, Constants.AuthToken);
                t.SendSmsMessage(Constants.From, user.Number, message);
            }

            return Json(new { success = true, users = all.Select(u => u.Number).ToArray() }, JsonRequestBehavior.AllowGet);
        }
开发者ID:joelmartinez,项目名称:onetug-twilio,代码行数:12,代码来源:RefTwilioController.cs


注:本文中的Twilio.TwilioRestClient.SendSmsMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。