SMS Web Hook

Pass Incoming SMS to Other Applications

Web Hook ( Passing Incoming SMS to Other Applications)

From GT Notify system, user can configure web hook to let the GT Notify system to pass the received message information (in json format) to other applications through HTTP Post.
  • The Json data file have 3 fields: Date, Phone, Msg
  • The application should receive and process the Json data, following is an example php code for receiving the Json data, decode the content, and insert into the database.
  • The result will be written to system log file, so user can check the status of the transaction.
Sample PHP code to process the web hook Json data and insert into database.

//define the database connection 
$host_name = ‘localhost’; 
$db_user = ‘xxxxx; 
$db_password = ‘xxxxxx’; 
$db_name = ‘xxxxxx’; 
$db_conn = mysqli_connect($host_name, $db_user, $db_password, $db_name); 
//receive the json data and decode the data into array $data 
$data = file_get_contents(“php://input”); $data = json_decode($data, True); 
//Insert $data[Date], $data[Phone], $data[Msg] into database 
$sql = “INSERT INTO gt_webhook (date, phone, msg) values (‘$data[Date]’,’$data[Phone]’,’$data[Msg]’)”; 
$ret = mysqli_query($db_conn,$sql);