.NET
Add SMS Controller
Right-click on the Controllers Folder and select add->Controller. Select "MVC Controller - Empty" and name it SmsController.
Add a using statements for Vonage.Messaging and Vonage.Utility at the top of this file.
Add Receive SMS Action
Finally we'll need to add a route to receive the webhook from Vonage, parse out the SMS data structure, and print some stuff to our console:
[HttpGet("/webhooks/inbound-sms")]
public IActionResult InboundSms()
{
var sms = WebhookParser.ParseQuery<InboundSms>(Request.Query);
Console.WriteLine("SMS Received");
Console.WriteLine($"Message Id: {sms.MessageId}");
Console.WriteLine($"To: {sms.To}");
Console.WriteLine($"From: {sms.Msisdn}");
Console.WriteLine($"Text: {sms.Text}");
return Ok();
}
How to Receive an SMS Message with ASP.NET Core MVC
A tutorial to show how your ASP .NET MVC application can use the Vonage .NET SDK to receive SMS messages from your users and display them in your output window.
Available on:
Steps
1
Introduction to this tutorial2
Prerequisites3
Create the SMS Project File4
Add Vonage Dotnet SDK5
Add an SMS Controller6
Run the .NET App7
Conclusion