INBOX (PUSH) - Receive SMS Inbox at an End Point
When you set up an Inbox Push URL, all the messages received on the SIM as an inbox are instantly forwarded to the specified URL. The URL must be valid and return "200 OK" for every query to be valid. The inbox is sent as HTTPS POST JSON data.
PARAMETERS
Parameter | Type | Description |
---|---|---|
from | string | The sender of the message |
message | string |
The content of the message |
server_name | string | The server name identifier as specified when setting up the server |
server_number | string | The phone number associated with the server |
received_time | string | The time the message was received in the format of YYYY-MM-DD HH:MM:SS |
SAMPLE JSON DATA
{
"from":"MTN Topit",
"content":"Ref: 20200609072407151065803482\nDATE: 2020-06-09 07:24\nAmt: N100.00\nPrev bal: NXXX.00\nBal: NXXX\nTo: 2348000000000",
"server_name":"MTN Server",
"server_number":"2348030000000",
"received_time":"2020-06-09 07:24:10"
}
Sample Code to Accept Data
Sample PHP code to retrieve the inbox data
<?php
$data = json_decode(file_get_contents('php://input'), true);
$from = $data['from'];
$content = $data['content'];
$server_name = $data['server_name'];
$server_number = $data['server_number'];
$time = $data['received_time'];
//Do whatever you want to do with the data
?>