1. Vonage Learn
  2. Blog
  3. 2017
  4. 07
  5. 21
  6. Get Sms Delivery Receipt Asp Net Mvc Dr
How to Get an SMS Delivery Receipt in ASP .NET MVC

< Tutorial />

How to Get an SMS Delivery Receipt in ASP .NET MVC

Now that you have successfully sent an SMS and received an SMS using your Vonage number, it’s time to check the status of the message to ensure it was delivered. To do this, we have to fetch the delivery receipt, which will return the delivery status of the message.


  • A Visual Studio project
  • A project set up as described in the previous blog post in this tutorial series which you can find on GitHub.
  • Optional: Vonage CLI

Receive webhooks on your localhost

The Vonage SMS API uses webhooks to inform the ASP.NET app of the status of the sent text message. As explained in the previous tutorial, we will be using ngrok to expose the port to the internet so Vonage’s servers can connect to it while testing.

Example of Ngrok running

Go back to Visual Studio and run your program, then head over to the Vonage Dashboard. On the Settings page, towards the bottom, you will see Callback for Delivery Receipt under the API Settings. Paste the ngrok URL inside the textbox and add /SMS/DLR to the end of it. This will route the message to the Receive action in the SMS controller.

Configuring Nexmo webhooks

Diving into code

In this tutorial series, we started by learning how to send an SMS.

In this first tutorial, we created an ASP.NET MVC project and added a controller called SMSController.cs. Afterwards, we created two action methods. One of which was to present the view for the details of the SMS (destination number and message text) and the other was to retrieve the values from the form and send an SMS.

In the second tutorial, we created another action method to print the details of incoming SMS message to the output window.

In order to read the delivery receipt, we will create an action method called DLR in the SMSController.cs.

Code example receiving DLR

As you can see in the code above, you need to add [FromUri] in the parameter to be able to read the delivery receipt. Above this method, add a HTTPGetAttribute to restrict the method to handling GET requests. Print the messageID (message ID), msisdn (Vonage virtual number), to (destination number), and the status (status message) to the output window using ‘Debug.WriteLine’. You can check the list of status codes here.

Now you are ready to go! Send an SMS using your Vonage virtual number and open up the output window in Visual Studio. There you should see the delivery receipt for the text you have sent! You have now successfully setup your virtual number to return a status for a text message via a webhook!

Example output of a DLR

Comments currently disabled.