Set a dynamic image for Rich push messages (beta)

Once you are enabled for the rich-push beta feature, you can use Jinja syntax to set a rich push image that changes based on a parameter value for a triggered push notification.

1. Create a new Push notification message.  

2. Set the URL of the image using new syntax Jinja to include your parameter.

https://myimages.com/destinations/cities/{{parameter['dest_code']}}.jpg

Imagepicker.png

Make sure you use brackets around the parameter name (see 'dest_code' above).

3. Trigger the push notification off the event whose parameter matches your image URL.

 

Android event with parameter example:

HashMap<String, Object> paramsFlight = new HashMap<String, Object>();
paramsFlight.put("dest_code""Varna");
Leanplum.track("flight_search", paramsFlight);

iOS event with parameter example:

Leanplum.track("flight_search", withParameters: ["dest_code""Varna"])

4. Test your new push notification on a real device before sending to users!

See iOS and Android examples below:

Screen_Shot_2017-12-22_at_17.03.46.png .  Screen_Shot_2018-01-25_at_11.32.41_AM.png

Things to note:

  • If the image does not exist, the push will be sent without the image. The image is resolved on the app, so the push will still be sent, but the image URL will not return an image.
  • If the parameter ("dest_code" in this example) is not provided in the event, the push will not be sent. Failing to provide the right parameter with the event will cause the Jinja customization to fail, which causes the entire message to not send.

Was this article helpful?
Have more questions? Submit a request