Send a Message
To send a text message using Gumband, just make an http request to our endpoint with the appropriate parameters. Here's some example PHP code to play with and a run through of what it does to get started.
1. Setup the variables
First, the code creates and initializes a number of variables.
$gumbandEndpoint = "http://www.gumband.com/send/send.php"; $outgoing_keyword = "YOUR_KEYWORD"; $message_to_send = "YOUR_MESSAGE"; $mobile_to_send_to = "YOUR_MOBILE_NUMBER"; $carrier = "YOUR_CARRIER"; $keyphrase = "YOUR KEYPHRASE"; $checksum = md5($outgoing_keyword . $message_to_send . $keyphrase);
$gumband_endpoint is the URL of the Gumband sending endpoint. You should not have to change this.
$outgoing_keyword is the keyword that you registered with Gumband. Even if you're only sending a message you still need to reference a keyword.
$message_to_send is the actual message that you want to send.
$mobile_to_send_to is the 10-digit mobile phone number where the message should be delivered.
$carrier is the carrier code (VERIZONUS, TMOBILEUS, etc.) of the mobile phone you are sending the message to. Whenever you receive a message via Gumband, we'll give you the mobile phone number and carrier of the sender. If you're just testing things out by sending messages to your phone, you can see a mapping of popular carriers at the top of the example code.
$keyphrase is the keyphrase that is associated with your account. This is NOT your password.
Finally, $checksum is computed by taking the md5 of the concatination of your keyword, message and keyphrase. This is how you "sign" requests to Gumband.
2. Send the request to Gumband
Once you have your variables initialized, we just have to send them to Gumband. In our example, we have a simple function that uses cUrl to make the request.
function runCurl($url, $params = null){
$session = curl_init();
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_POST, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_URL, $url);
if($params != null) {
curl_setopt($session, CURLOPT_POSTFIELDS, $params);
}
$response = curl_exec($session);
curl_close($session);
return $response;
}
$curlResp = runCurl($gumbandEndpoint, array(
'keyword' => $outgoing_keyword,
'message' => $message_to_send,
'carrier' => $carrier,
'handset' => $mobile_to_send_to,
'checksum' => $checksum
));
echo $curlResp;
The code above just takes your variables, sends them to the Gumband endpoint and displays the response from Gumband. Note the parameters that Gumband is expecting: keyword, message, carrier, handset, and checksum.
Gumband will respond with an HTTP 200 if there were no errors. If a problem was encountered (an invalid checksum for example) a 500 error will be returned along with an explanation.
That's all there is to sending a message with Gumband. 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!
