0
I’m trying to learn to mess with the twilio applying it to a project, even testing, in ASP.NET MVC 5.
Amid my Google dig, I found this tutorial here which explains how to use it.
I did everything according to what you have in this tutorial, but when testing, I even receive the message that the SMS was sent, but I do not receive any message at my number....
I don’t know if I’m doing something wrong in my code, or if I’m getting it wrong on the website itself. I know that Brazilian numbers generated by twilio do not send message yet, so I ended up creating another account and changing the number, because free account can not change number.
I also know that we can use test credentials to send messages without the need to pay for it. But they actually work, but no texting...
Anyway, I’ll put the controller here (although I think the problem is in my account) so that someone can help me.
Controller
public ActionResult Index()
{
ViewBag.SendSmsResultMessage = TempData.ContainsKey("SendSmsResultMessage") ? TempData["SendSmsResultMessage"] : String.Empty;
return View();
}
[HttpPost]
public ActionResult SendSms(string sid, string token, string fromPhoneNumber, string toPhoneNumber, string message)
{
var twilioClient = new TwilioRestClient(sid, token);
var sendMessageResult = twilioClient.SendMessage(fromPhoneNumber, toPhoneNumber, message, "");
if (sendMessageResult.RestException == null)
TempData["SendSmsResultMessage"] = "Mensagem enviada com sucesso!";
else
TempData["SendSmsResultMessage"] = "Houve um erro durante a tentativa de enviar a mensagem: " + sendMessageResult.RestException.Message;
return RedirectToAction("Index");
}
Has anyone ever used their service to help me ? Be another tutorial on how to create numbers and send this test ?
Then I’d have to buy a number so he can send a message to the right Brazilian numbers ?
– Érik Thiago
does not work in Brazil. You will have to resort to another service.
– Thiago Custodio
thanks for the clarification. I’ve been reading the documentation on this link you sent me and added some more information to your reply! Thanks.
– Érik Thiago