本文整理汇总了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);
}
示例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());
}
示例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;
}
示例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
}
示例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);
}
示例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
);
}
}
}
示例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();
}
示例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, "");
}
示例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);
}
示例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");
}
示例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", "");
}
示例12: Send
public void Send(string message, string phoneNumber)
{
var twilio = new TwilioRestClient("AC654fe8d243f96cb77397f0f280ab504f"
, "f86acec80f8bea5ff10db08837804f80");
twilio.SendSmsMessage(_twilioNumber
, phoneNumber
, message);
}
示例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);
}
示例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";
}
示例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);
}