The following steps outline how to send a push message to a specific customer ID. For more information on how Localytics utilizes customers IDs, check out our user profiles section. If you are looking to find out what your specific customer ID is, please consult this article on using Charles Proxy to extract it.
- Download Postman. This is a utility that allows you to easily execute API requests that would otherwise require writing scripts.
- Find your API credentials in the Localytics dashboard. These will be required for you to authenticate and use Postman to get Profiles data back, or send a push message to a specific Customer ID. Credentials can be found by clicking "Settings" then "API Keys." The API key you need in this case is listed under "Localytics Profiles & Push API Key."
- Insert your API key and API secret from the Localytics dashboard into the Postman tool using "Basic Auth". Then hit "Update Request". This will make sure that when execute a request in the next step you have proper permissions. Note that there is nothing you can do wrong here; worst case, you enter something incorrect and it doesn't work but nothing breaks.
- Type in the following URL string next in the top field making sure you have selected "POST" in the drop down that is adjacent: https://messaging.localytics.com/v2/push/123456. Note that the text string at the end of the URL is the App Key. Basically, this is how you instruct Localytics to issue a push message for the specific App Key of interest. Then, navigate to "Headers" and insert a new Key
Content-Type
with the valuetext/json
.
- Navigate to "Body" and select "raw." Use this text box to insert the following template (including all brackets):
{ "campaign_key":null, "target_type":"customer_id", "messages":[ { "target":"123456", "alert":"Body of message goes here" } ] }
Fill in the appropriate values. The value for the
target
field - in the template above,123456
- should be replaced with the specific customer ID you want to send a push message to. The vaue for thealert
field - in the template above,Body of message goes here
- should be replaced with the message you want to appear on the recipients device. Once filled out correctly, click "Send" to deliver yourmessage. If you are looking to pass a key/value pair, see Step 7 for additional information. - Assuming the correct customer ID was entered, the user should receive the push message within seconds of clicking "Send."
- (Optional)
To pass a key/value pair with the push API, they should be specified in "extra" attribute within "ios" (or "android") object. The following represents this format for iOS:{ "campaign_key": null, "target_type": "customer_id", "messages": [ { "target": "some_customer_id", "alert": "Body of the message goes here", "ios": { "extra": {"someKey":"someValue","someOtherKey":"someOtherValue"} } } ] }