Skip to content
Home » Octopush Gateway SMS API » Managing Replies with Two-Ways SMS

Managing Replies with Two-Ways SMS

Fields of application

NameDefinition
message_idTicket of the original message
numberMobile number
textText of the response
answer_dateDate of when the response was received, in the format “Ymd H:m:s” (Y-m-d H:i:s)
The request fields can also been sent as an array

Simple PHP recovery script example.

$fp = fopen('callbacks.txt', 'a');
fputs($fp, 'message_id : ' . $_POST['message_id'] . "n");
fputs($fp, 'number : ' . $_POST['number'] . "n");
fputs($fp, 'text : ' . $_POST['text'] . "n");
fputs($fp, 'answer_date : ' . $_POST['answer_date'] . "n");
fclose($fp);

Simple sample of PHP scratching, with arrays, in your script

$fp = fopen('callbacks.txt', 'a');
$message_ids = $_POST['message_id'];
$numbers = $_POST['number'];
$texts = $_POST['text'];
$answer_dates = $_POST['answer_date'];
for($i=0, $i < count($messages_ids); $i++)
{
fputs($fp, 'message_id : ' . $message_ids[$i] . "n");
fputs($fp, 'number : ' . $numbers[$i] . "n");
fputs($fp, 'text : ' . $texts[$i] . "n");
fputs($fp, 'answer_date : ' . $answer_dates[$i] . "n");
}
fclose($fp);