You can target an individual user or device either from the API or directly in the Control Panel.
Method 1: Using the API
Note: /createMessage is now marked Deprecated in the API reference. It remains fully operational, but new integrations should use the unified Messaging API v2, which replaces the whole /create*Message family with one endpoint. The per-user and per-device targeting shown below works the same way in both.
With /createMessage, specify the exact User IDs or HWIDs in the request payload.
-
users— target by User ID. Up to 1000 user IDs per array. -
devices— target by push token or HWID. Up to 1000 tokens/HWIDs per array. iOS push tokens must be lower case.
{
"request": {
"application": "YOUR_APP_CODE",
"auth": "YOUR_API_TOKEN",
"notifications": [
{
"send_date": "now",
"content": "This is a targeted message.",
"users": [
"user_id_1",
"user_id_2"
]
}
]
}
}
Note: if users is specified together with devices (or to), the latter is ignored. Application Groups cannot be used with the users or devices lists.
See the Messages API documentation for details.
Method 2: Using the Control Panel
- Target by User ID directly. Go to Audience → Segments, click Create Segment → Build Segment, then choose User ID under Add filter by and add the User IDs you want. Save the segment and select it as the audience of your message. You can combine the User ID filter with Tag, Event, Segment or Geo filters. Enable Include all user devices to reach the user on every device they own.
- Upload a list of User IDs or HWIDs. Go to Audience → Segments → Create Segment and select Import Segment, then upload a CSV (under 100 MB) containing User IDs or HWIDs and point the import at the column holding them. Identifiers that are not registered for the project are skipped.
- For testing and debugging. Add the device’s HWID to your Test Devices list and send test messages to it from the message creation screen.
Comments
0 comments
Please sign in to leave a comment.