Full Access - Free Credits
Takes 60 Seconds
Our Latest Reviews
View allView our Tutorials
See our latest Messenger video tutorials for help and advice on how to get started
Watch NowDeveloper API: Receive SMS Texts Online
Instantly forward SMS text messages to your application
You can configure any of your Textlocal inboxes to send a notification to a URL whenever you receive a message; this is perfect for two-way communication via your website or application. To enable message notifications, simply enter your URL into the inbox settings within Messenger.
Overview
Once you've configured your Textlocal inbox settings to forward to your URL, the following variables will be sent as POST variables:
| sender | The sender's mobile phone number in international format. For example, UK numbers will be formatted as 447123456789. |
|---|---|
| keyword | If applicable, the keyword of the inbox. |
| content | The full message content. |
| comments | If applicable, the message without the inbox keyword. |
| inNumber | The inbound number the message was sent to. |
| Any email address extracted from the message. | |
| credits | The number of SMS credits remaining in your Textlocal account. |
| refid | Unique reference for the message received. |
Code Examples
As all we are doing is sending you variables, it's quite difficult to show code examples, however the following might help - including, in some languages, examples of writing the variables to a database and/or file:
$inNumber = $_REQUEST["inNumber"];
$sender = $_REQUEST["sender"];
$keyword = $_REQUEST["keyword"];
$content = $_REQUEST["content"];
$email = $_REQUEST["email"];
$credits = $_REQUEST["credits"];
$refid = $REQUEST["refid"];
// Example: Writing to a file //
// File format: id, sender, content //
$fp = fopen('data.csv', 'a');
fwrite($fp, $refid.", ".$sender.", ".$content."\r\n");
fclose($fp);
// Example: Writing to a database //
$mysqlic = new mysqli("localhost", $database_username, $database_password, $database_name);
If (mysqli_connect_error()) { die('Connect Error: '.mysqli_connect_errno().' - '.mysqli_connect_error()); };
$sql = "INSERT INTO inbound_contact (refid, sender, message) ";
$sql .= "VALUES ('".mysql_real_escape_string($refid)."', ";
$sql .= "'".mysql_real_escape_string($sender)."', ";
$sql .= "'".mysql_real_escape_string($content)."')";
$mysqlic->query($sql);
Create Your Free Account - 60 Second Signup - Free Expert Support




