當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。