Delivery Reports


    Once the Message API request is successful, your SMS will be put into a queue to be sent to its destination. By default, you will not receive an automatic notification regarding the delivery of your SMS. To get notified on the status of your message, include the url parameter in your API request. You can also find your SMS delivery reports in the SMS Logs of your Plivo account. This will automatically output a notification when your SMS reaches its destination, or if it fails to deliver. Your delivery report will update to show either "queued", "sent", "delivered", "undelivered", or "failed" for each individual recipient.

    Note: Long SMS messages are automatically split and concatenated into a seamless user experience. When checking Message Logs and Delivery Reports for long SMS messages that are split, look for the `ParentMessageUUID`, which is the same in all split messages and identical to the UUID of the first message in the split sequence of messages.
    Advanced Hack: Check out our Message API docs to see how you can get the details of a single message or all your messages in a single GET request.


    In this section, we will guide you to build an app to Receive Delivery Reports.


    • Plivo Auth Id and Auth Token: You will find your Plivo Auth Id and Auth Token on the home screen of your Plivo Console. Click here to sign-up for a Plivo account if you haven’t already!

      Find Your Auth Credentials on Plivo Console

    • Plivo Phone Number(Optional): To send messages to the United States and Canada, you must have a Plivo phone number that supports SMS. Numbers can be purchased from the Numbers section of your Plivo Console and use the same as the source number/from number for the outbound SMS. This number will also help you receive incoming SMS as you must have a SMS-enabled Plivo phone number to do the same. Please note that you can also purchase numbers using the Numbers API.

      Buy a New Plivo Number

    Install Go and the Plivo Go Server SDK

    You must set up and install Go and Plivo’s Go SDK to Receive Delivery Reports. Here’s how.

    Install Go

    You can install Go from the Official Installer.

    Install Plivo & Martini Go Package

    • Create a project directory, run the following command:

      $ mkdir mygoapp
    • Change the directory to our project directory in the command line:

      $ cd mygoapp
    • You can install the Plivo Go package using the go command.

      $ go get
      $ go get
    • You can also install by cloning this repository into your GOPATH.

    Delivery Reports

    Below is the code to handle delivery reports.

    package main
    import (
    func main() {
    	m := martini.Classic()
    	m.Get("/delivery_report", func(w http.ResponseWriter, r *http.Request) string {
    		w.Header().Set("Content-Type", "application/xml")
    		// Sender's phone number
    		fromnumber := r.FormValue("From")
    		// Receiver's phone number - Plivo number
    		tonumber := r.FormValue("To")
    		// The text which was received
    		text := r.FormValue("Text")
    		//Message UUID
    		uuid := r.FormValue("MessageUUID")
    		// Print the message
    		print("Message Received - ", fromnumber, " ", tonumber, " ", text, " ", uuid)
    		return "Delivery status reported"

    Sample Output

    From: 1111111111, To: 3333333333, Status: delivered, MessageUUID: 0936ec98-7c4c-11e4-9bd8-22000afa12b9

    Exposing your local server to the internet

    To receive Incoming Messages and to handle callbacks, your local server should be able to connect with Plivo API service, Ngrok is a tunneling software used to expose a web server running on your local machine to the internet. Using Ngrok you can set webhooks which can talk to Plivo server.

    ngrok block diagram

    You can download and install ngrok from here. Follow the detailed configuration instructions to get started.

    Run ngrok on the port which currently hosts your application. For example, if your port number is 80, run the following command:

    ./ngrok http <port_on_which_your_local_server_is_running>

    This will give you a UI with links that look like* which you can use to access your local server using the public network.

    Sample ngrok CLI

    Create an Application

    1. Create an Application by visiting the Application Page and click on New Application. You can also use Plivo’s Application API.
    2. Give your application a name. Let’s call it Receive SMS. Enter your server URL (e.g. in the Message URL field and set the method as POST. See our Application API docs to learn how to modify your application through our APIs.
    3. Click on Create Application to save your application.

    Create Application

    Assign a Plivo number to your app

    1. Navigate to the Numbers page and select the phone number you want to use for this app.
    2. Select Receive SMS (name of the app) from the Plivo App dropdown list.
    3. Click on Update to save.

    Assign Phone Number to Receive Delivery Reports

    Test and validate

    Send an SMS to your Plivo number using a regular mobile phone. Plivo will send a request to your Message URL with the parameters listed in the Messages Documentation.