– Want to get a sms message when someone send a feedback on your website?
– Want to send a confirmation SMS when your user submit an order on your website?
– Want to send a notification SMS when your users order being delivered?
– Want to trigger an application when receive an incoming SMS message?
The answer to the above questions are SMS Gateway.
SMS gateway is an appliance or a software to interface with computer program or web site program, to forward the message to the users mobile phone through SMS messages.
Compare to email, SMS message is faster and more reliable way to communicate to your user.
SMS HTTP API
The most simple way is using HTTP method, just a simple HTTP statement can trigger a SMS message to be sent out to the user’s mobile phone. This command can be triggered from the browser, or from a php script.
Example URL Request:
num: SMS phone number
msg: SMS message to be send out
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.
<?php //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); ?>
SUB API (Subscriber API) – Version 3.24 & above
Another api has been created for application to direct trigger the auto-responder and add on subscriber from outside applications:
num: SMS phone number
The above api will direct create a subscriber, and insert relevant fields into the subscriber field. If there is an auto-responder defined for that KEYWORD, an auto SMS will be trigger to send to that number.