Notifications

A notification is information sent to your application whenever we need to let you know that something has occured. For example, when a message is sent to your shortcode, we immediately let you know via a notification with the details of that message.

Notifications are sent to the callback URL you set on your application for a given product. You can set your application's callback URLs from the dashboard.

Notifications are POST requests

We send notifications as POST requests and you can read the data sent from the form fields of the request. How you do this depends on the language you're using. Here is an example of how to read notification values using PHP

<?php
// Save this code in handleNotification.php
// Configure the callback URL for your product (incoming sms, ussd, voice e.t.c)
// to point to the location of this script on the web
// e.g http://www.myawesomesite.com/handleNotification.php
// Read in a couple of POST variables passed in with the request
$sessionId    = $_POST["sessionId"];
$phoneNumber  = $_POST["phoneNumber"];

// You can then log the notification details to the console or
// store it in the database for your records or
// perform any extra logic depending on your application.
echo $sessionId;
echo $phoneNumber;