Receive a Message
Receiving a message from Gumband is easy. For each keyword that you register, you'll provide a URL that Gumband will forward messages to. Your endpoint needs to be publicly accessible and it must be able to parse the parameters that Gumband sends. After that, it's up to you. Here is some example PHP code that will serve as an starting point for your endpoint.
This code simply any logs any request parameters that come in to the error log.
1. Compute and verify the checksum
$requestKeys = array_keys($_REQUEST);
$keyphrase = "this is my secret password";
$myChecksum = md5($_REQUEST['keyword'] .
$_REQUEST['smsmsg'] .
$keyphrase);
if ($myChecksum != $_REQUEST['checksum']) {
error_log('no good');
return;
} else {
error_log('good');
}
You will need to change the $keyphrase variable to whatever you
previously set it to . Once that is done, you can compute your own checksum based on the keyword and smsmsg HTTP request parameters that Gumband sent to your endpoint. You can then compare the checksum that you computed to the one that Gumband sent you to verify that the message is really from us.
Print all of the parameters
foreach($requestKeys as $r_key) {
error_log("Parameter: $r_key Value: ".$_REQUEST[$r_key]);
}
Now we just loop through all of the request parameters and write them out to the PHP error log so that you can see everything that Gumband is delivering to your endpoint. Whenever Gumband delivers a message to this endpoint, you will see something like this in your error log:
Parameter: network Value: CINGULARUS Parameter: smsfrom Value: 1412555555 Parameter: smsto Value: 25252 Parameter: shortcode Value: 25252 Parameter: smsid Value: 3651542070 Parameter: smsmsg Value: Tutorial Parameter: bits Value: 7 Parameter: smsdate Value: 2009-10-26 18:38:09 Parameter: keyword Value: TUTORIAL Parameter: provider Value: deeplocal Parameter: checksum Value: bbbe59923e6f3fa85707eed8f5418a8e
The parameters that you will be most interested in are: network, smsfrom, smsmsg, and keyword. After this, it's up to your application to do whatever it needs with this incoming message. Anything from storing the result in the database to sending an SMS response.
That's all there is to it. You can also check the examples page for some more ideas about how Gumband can be used. Don't hesitate to contact us with any questions!
