I am trying to use Plivo's API to send and receive SMSs to mobile numbers in America. I want to receive their reply in my web application. like we receive message from mobile company and then reply their options in same thread usually.
I am using this code to receive the reply but not sure that where to deploy this code either to make class and put code in it or call it to my webservice.asmx any idea please
using System;
using System.Collections.Generic;
using System.Reflection;
using Nancy;
using RestSharp;
using Plivo.API;
namespace Receive_Sms
{
public class Program : NancyModule
{
public Program()
{
Post["/receive_sms"] = x =>
{
String from_number = Request.Form["From"]; // Sender's phone number
String to_number = Request.Form["To"]; // Receiver's phone number
String text = Request.Form["Text"]; // The text which was received
// Print the message
Console.WriteLine("Message received - From: {0}, To: {1}, Text: {2}", from_number, to_number, text);
return "Message received";
};
}
}
}
I am also open to using other providers than Plivo.