Sections ▾

POST ​/api​/push_notifications

Unified endpoint to send push notifications across all service platforms (APNS & GCM). By sending notifications to devices with a certain tag, you can send a single notification to IOS and Android devices. Certain APNS keys (alert, badge, sound, category) will be duplicated in the GCM message payload to simplify sending similar messages to different platforms.

When sending notifications to multiple platforms, you need to be mindful of payload size limits:

  
  curl -X POST "https://app.contexthub.com/api/push_notifications" \
       -H "Authorization: Token token=\"534e565f-335a-469d-974e-e18a85f00d2d\"" \
       -H "CONTEXTHUB_DEVICE_ID: DB4E6157-D64F-43EE-B114-39A13D2B9BC7" \
       -H "Content-Type: application/json" \
       -d $'{ "device_ids":["0C07F53C-5C14-441B-A977-C6AF473770F8", "A065427D-B111-45D7-A004-546044E6966E", "666B1F70-FD24-43BB-9258-EC7CC75908D6"],\n"alert":"Hello world",\n"badge": 42\n}' \
       -m 30 \
       -v \
  

Request

Example Request

{
  "push_tokens": [
    1
  ],
  "alias": "iphone",
  "tags": {
  },
  "tag_operator": "ALL",
  "device_ids": [
    "B3B9CEE2-EE80-4815-957A-40CDB4D1BF8C"
  ],
  "exclude_device_ids": [
    "B3B9CEE2-EE80-4815-957A-40CDB4D1BF8C"
  ],
  "exclude_push_tokens": [
    "B3B9CEE2-EE80-4815-957A-40CDB4D1BF8C"
  ],
  "mdm": "magic",
  "priority": 10,
  "expiry": 0,
  "category": "INVITE_CATEGORY",
  "url_args": "",
  "badge": 42,
  "sound": "default",
  "alert": "Hello World",
  "content_available": 1,
  "collapse_key": "new content",
  "data": {
  }
}

Example Parameters

Response

Example Response

{
}

Response Parameters

Response Codes

Successful Response Codes

Failure Response Codes