Using caller id as twilio number in asp.net mvc
I opened a trial twilio account. I want to use my verified id in my asp.net app instead of buying a new twilio number. But I don't know how to use it. Here are my codes,
public ActionResult SendSms()
{
string ACC_SID = ConfigurationManager.AppSettings["ACC_SID"];
string AUTH_TKN = ConfigurationManager.AppSettings["AUTH_TKN"];
TwilioRestClient client = new TwilioRestClient(ACC_SID, AUTH_TKN);
client.SendMessage("+8801941234567", "+8801671234567", string.Format("This is a test message!"));
return RedirectToAction("SmsView");
}
Nothing happened to that. How can I use my ID to send sms?
source to share
I ran into the same scenario when I first worked on Twilio and at the time I used below steps to make it work.
1) First of all, I would suggest adding a Try {} catch {} block to the SendSMS block. this will give you an idea of how SendMessage worked correctly.
2) In twilio, we need to register a mobile connection before sending SMS.
3) if your function is working fine (no errors occur) then there is a LOG tab in Twilio where you can see if your SMS is sending correctly or not.
source to share
Twilio developer evangelist is here.
Jinesh's answer has some useful parts like using a try / catch block to watch for errors.
However, the problem is that you are trying to send SMS from your own number and not from the Twilio number. When sending SMS, you can only send Twilio numbers. See this page for details .
You must receive a Twilio number upon registration. Try using that number like instead From
.
source to share