Push by User ID

Send targeted push messages to users across their multiple devices

This method allows you to send targeted push notifications to your users across their multiple devices. Resulting push notifications will be delivered to all devices associated with a specified User ID.

Collecting User IDs

Call setUserId with the first app launch or in case your User ID has changed. User ID could be a user identifier that you keep in your own database.

(void)setUserId:(NSString *)userId

Login/Logout behavior

By default, when an app with Pushwoosh SDK is launched for the first time, it sets a device HWID as a UserID. You can call setUserId on a login to set any required value to associate a device with a particular user. When a user logs out, you can reset this value to a default one with another setUserId call, e.g. to an initial HWID value.

Sending a push by User ID

To send a push to a list of users, you can either use /createMessage API call, or upload a CSV file with the User ID's.

/createMessage

Please note that /createMessage parameters are fully customizable, so you can create a highly tailored push message.

Request

{
	"request": {
		"application": "APPLICATION_CODE",
		"auth": "API_ACCESS_TOKEN",
		"notifications": [{
			"send_date": "now",
			"content": "Hello world!",
			"users":["external_user_1"]
		}]
	}
}

Response

{
   "status_code":200,
   "status_message":"OK",
   "response": {
      "Messages":["{Notification code}"]
   } 
}

Parameters

Parameter

Description

application

Your Pushwoosh application ID where you send the message to (cannot be used together with "applications_group")

auth

API access token from the Pushwoosh control panel

send_date

Set the time you want the message to be sent (in UTC) or use 'now' to send it immediately.

content

The text for your push notification.

users

A list of User IDs your push message is sent to. You can send a push to a 1000 User IDs at once.

Last updated

Change request #1685: