The Hipmob REST API now talks directly with your app's backend.
The easiest way to add messaging to your app, now integrates with PHP, Node.JS, and Python. See some examples
Send support messages to your users, including text, images & audio.
Dynamically manage your users' buddy lists.
Check your users' status(es) to see if they're online, offline, or mid-conversation.
And anything else that requires scalable, real-time messaging for your app.
Plug and play in 15 minutes for your
iPhone, iPad (and Android) app(s).
Focus on your app, we'll do the heavy lifting.
Real-time & async messaging on a scalable XMPP infrastructure.
or call us at (650) 762-6513
EXAMPLE CODE: Sending Picture Messages
{app mobile key}/devices/{host application identifier}/messages| Name | Required | Quantity | Description |
|---|---|---|---|
| Content-Length | Yes | Exactly Once | The size of the picture to be sent, in bytes. |
| X-Hipmob-Autocreate | No | At most once | The text true if the message should be sent regardless of whether or not the target host application identifier has been seen yet. |
415 error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | // copy the lib folder from the PHP library into the current directory, then set the required // environment variablesif(!isset($_SERVER['hipmob_username'])){echo "Please provide the username as an environment variable.\r\n";return;}if(!isset($_SERVER['hipmob_apikey'])){echo "Please provide the API key as an environment variable.\r\n";return;}if(!isset($_SERVER['hipmob_app'])){echo "Please provide the application mobile key as an environment variable.\r\n";return;}// update this variable to be the host application identifier you're interested in$deviceid = "{specific device id}";// set this to the path of the PNG, GIF or JPEG image to be sent$picture = "{picture file path}";// specify the image mime type: acceptable values are image/jpeg,// image/gif and image/png$picture_mime_type = "image/jpeg";require_once(dirname(__FILE__) . 'lib/Hipmob.php');$hipmob = new Hipmob($_SERVER['hipmob_username'], $_SERVER['hipmob_apikey']);// passing false for the third parameter prevents the library from hitting the server// to verify that the device exists: if you're certain the device exists then this// is more efficient$device = $hipmob->get_device($_SERVER['hipmob_app'], $deviceid, false);print_r($device->send_picture_message($picture, $picture_mime_type)); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # install Hipmob using "pip install hipmob", then set the required environment variablesimport sys, os, hipmobif 'hipmob_username' not in os.environ:print "Please provide the username as an environment variable.";sys.exit()if 'hipmob_apikey' not in os.environ:print "Please provide the API key as an environment variable.";sys.exit()if 'hipmob_app' not in os.environ:print "Please provide the application mobile key as an environment variable.";sys.exit()# update this variable to be the host application identifier you're interested indeviceid = "{specific device id}"# set this to the path of the PNG, GIF or JPEG image to be sentpicture = "{picture file path}";# specify the image mime type: acceptable values are image/jpeg,# image/gif and image/pngpicture_mime_type = "image/jpeg";hipmob = hipmob.Hipmob(os.environ['hipmob_username'], os.environ['hipmob_apikey']);res = hipmob.get_device(os.environ['hipmob_app'], deviceid)print "Sending message: "+str(res.send_picture_message(picture, picture_mime_type))+"." |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | // install Hipmob using "npm install hipmob", then set the required environment variablesif(!('hipmob_username' in process.env)){console.log("Please provide the username as an environment variable.");return;}if(!('hipmob_apikey' in process.env)){console.log("Please provide the API key as an environment variable.");return;}if(!('hipmob_app' in process.env)){console.log("Please provide the application mobile key as an environment variable.");return;}// update this variable to be the host application identifier you're interested invar deviceid = "{specific device id}";var hipmob = require("hipmob");var handle = hipmob(process.env.hipmob_username, process.env.hipmob_password);var dev = handle.get_device(process.env.hipmob_app, deviceid, false);// set this to the name of the file to sendvar image = "/home/me/funnypicture.png";// you can pass it either a file or a Buffer: it can not be a stream because we must know // the Content-Length to successfully send the file.dev.send_picture_message(image, "image/png", function(err){if(!err){ console.log("Message sent."); }else{ console.log(err); }}); |