How do I send custom parameters like emoji in my push notifications?

You can utilize the "Custom Data" JSON payload in Mixpanel's push notification builder to send customized push notifications that contain emojis, sounds, alerts, icons, titles, or deep links. For details on how to add dynamic content to your push notifications, please refer to this guide.

JSON Payload

The custom JSON payload is a data payload which is delivered with a push notification. When a JSON payload with valid keys is received by your app, the device will ignore the message entered in the main field of the Mixpanel message editor and display the custom payload instead.

Drawing

iOS

In iOS, the payload is processed automatically by your app -- you can find a full list of the available JSON parameters here. The following example will send an iOS push notification with the message "TEXT GOES HERE":

{"aps": {"alert": "TEXT GOES HERE"}}

You can further customize this message by including additional parameters such as those on Apple's site. The full list of JSON keys for iOS includes:

  • alert (Message)
  • badge (Icon)
  • sound (Sound)
  • content-available (Background Content, typically used for "silent push" notifications)

Including the above keys with valid values will customize the look and feel of your push as desired.

Android

For Android, the JSON keys need to be handled as intents by your app -- in the Mixpanel library, this happens by default for a few specific keys. The following JSON payload will send an Android push notification with the message "TEXT GOES HERE":

{"mp_message": "TEXT GOES HERE"}

In this sample, like the one above, you have the option of customizing the message further with additional JSON keys. The full list of JSON keys for Android includes:

  • mp_message (Message)
  • mp_icnm (Icon)
  • mp_cta (Link)
  • mp_title (Title)
  • mp_icnm_l (Large icon to be used on a push)
  • mp_icnm_w (White icon to be used on Lollipop and above)
  • mp_color (Color to be used on Lollipop and above (#argb))

Example Android payload:

{"mp_icnm":"an_icon", "mp_icnm_l":"big_icon", "mp_icnm_w":"white_icon","mp_color":"#FFAA0000"}

Just like with iOS, including these keys with valid values will change the styling of the push received by an end user.

Emojis

Of special interest is the ability to send emojis in your push notifications. The easiest way to do this is to paste the emoji inside the text field of the visual editor. If you wish to combine emojis with custom parameters, such as deep links, please read the article below.

How do I send a push notification that contains both an emoji and a deep link?

Once these push notifications are sent from Mixpanel, you can see the emoji on the device:

DrawingDrawing


If you find yourself struggling to implement any of the above for your push notifications, or simply have questions on how this can be done please email support@mixpanel.com and we would be happy to assist further.