Sends a message (typically a push notification) to one device or user. You must provide a deviceId and/or a userId. If deviceId is provided, the message will be sent to the corresponding device only; if only userId is provided, the message will be sent to all devices of the user with specified userId. If the user/device does not exist, the API request is skipped and a warning will be returned. You can modify this behavior with the createDisposition option (see below).

Messages are queued, so they will be sent after the request completes.

This method requires your production API clientKey.

Example for sending values in the sendMessage API

See below for an example sendMessage API call with two values.{"key":"val", "key2":"val2"}

Once you pass the values via the API, you'll be able to access them in the body of the message in the Leanplum dashboard. For example, if you set values={"name":"Donna", "points":5} in the API call, you could format your message body in the dashboard to say, "Hey Donna! congrats on getting 5 points today!"

To insert the values into your message body, use the Insert value tool {{ or format your message content as follows: "Hey {{Value "name"}}! Congrats on getting {{"points"}} today!"


Jinja formatting for values

Note that any of the following will work in the above case:

  • {{"points"}}
  • {{Value "points"}}
  • {{value['points']}} (optimal for use in HTML code to avoid double quotes conflicts)