sendMessage

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.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
required
Defaults to YOUR_APP_ID

The application ID. To find yours, select your app in the navigation column, and click Manage Apps. Then click Keys & Settings.

string
required
Defaults to YOUR_PROD_KEY

The Production key for your Leanplum App.

string
enum
required
Defaults to 1.0.6

The version of the Leanplum API to use. The current version is 1.0.6.

Allowed:
string
required
Defaults to hfarnsworth

The current user ID. You can set this to whatever your company uses for user IDs. Leave it blank to use the device ID. For more info, see selecting a user.

string

A unique ID for the device targeted by the request. You must provide a deviceId and/or a userId. See selecting a user.

number
required

The ID of the message, found in the URL when viewing a message (e.g. www.leanplum.com/dashboard#/{APP_ID}/messaging/{MESSAGE_ID}.

string

A JSON object of key-value pairs to override template variables used in the message. See below for example.

boolean
Defaults to false

Whether to send the message regardless of whether the user meets the targeting criteria. Default: false.

boolean
Defaults to false

Whether the user is in Development Mode, i.e. the user associated with the request is a developer and not a user. This is important for reporting purposes. Default: false.

string
enum
Defaults to CreateNever

The policy that determines whether users are created by the API. Possible values:

  • CreateIfNeeded creates a user with the given IDs if one does not already exist.
  • CreateNever requires that the user already exists, otherwise the API action is skipped and a warning will be returned.

The default value for this method is CreateNever.

Allowed:
Response

Language
Credentials
URL
LoadingLoading…
Response
Choose an example:
application/json