Mobile DevicesΒΆ

HipChat provides a set of XMPP APIs to allow clients to manage devices (iOS, Android, etc.). These APIs are all IQ stanza’s qualified by the http://hipchat.com/protocol/device namespace.

To remove a device of a given type from the users account an IQ of type delete is sent containing a query with the type of device to remove and the device identifier:

<!-- Client -->
<iq type="delete" id="1">
  <query xmlns="http://hipchat.com/protocol/device" type="ios">
    <device_id>abcdefg</device_id>
  </query>
</iq>

<!-- Server -->
<iq type="result" id="1"/>

You can also remove all devices of a particular type from a system by leaving off the device ID, eg.

<!-- Client -->
<iq type="delete" id="1">
  <query xmlns="http://hipchat.com/protocol/device" type="ios" />
</iq>
stanza:IQ
xmlns:http://hipchat.com/protocol/device
http:None

To add a device you’ll need to either specify a token (in the case of iOS devices) or a device ID and registration ID (in the case of Android devices). This is done by sending an IQ stanza of type “set” containing a query similar to the following:

<!-- Client -->
<iq type="set" id="1">
  <query xmlns="http://hipchat.com/protocol/device" type="android">
    <device_id>abcdefg</device_id>
    <registration_id>1234567890</reg_id>
  </query>
</iq>

<!-- Server -->
<iq type="result" id="1"/>

Or, for an iOS device:

<iq type="set" id="1">
  <query xmlns="http://hipchat.com/protocol/device" type="ios">
    <token>123abc</token>
  </query>
</iq>
stanza:IQ
xmlns:http://hipchat.com/protocol/device
http:None