You can send send messages manually to your users individually using your own server and our API. This method works for push notifications, app inbox messages, email, and webhooks.
First, you need to create and start the message in the Leanplum Dashboard. Go to the Messaging dashboard and create a new message.
Select Push Notification, Email, Webhook, or App Inbox Message. Set the Delivery to Manual. When you're finished composing the message and setting your targets, click Start.
You can trigger the message using the sendMessage method of our API. If you want to send the message to the selected user even if they do not match the targets, use force = true.
You must provide a deviceID and/or a userID. If deviceID is provided, the message will be sent to the corresponding device only; if you only provide the userID, the message will be sent to all devices of the user with specified userId. Messages are queued, so they will be sent after the call completes.
If the user/device does not exist, the API call is skipped and a warning will be returned. You can modify this behavior with the createDisposition option (see below).
|string||The version of the Leanplum API to use. The current version is 1.0.6.|
|string||The API method. Set this to sendMessage.|
|string||Your App ID. To find your appId, go to App Settings, find your app, and click Keys & Settings.|
|string||Your Production API key. To find your clientKey, go to App Settings, find your app, and click Keys & Settings.|
required (unless you choose to use deviceId)
|string||The user ID of the targeted user. You can set this to an email address or whatever you use at your company for user IDs. Leave it blank to use the device ID. For more info, see Selecting a user.|
|number||The ID of the message, found in the URL when viewing a message (e.g. |
|createDisposition||string||The policy that determines whether users are created by the API. Possible values:|
The default value for this method is
only required if you do not include a userId
|string||A unique ID for the device targeted by the call. You must provide a deviceId and/or a userId. See Selecting a user.|
|devMode||boolean||Whether the user is in Development Mode, i.e. the caller is a developer and not a user. This is important for reporting purposes. Default: false.|
|force||boolean||Whether to send the message regardless of whether the user meets the targeting criteria. Default: |
|values||object||A JSON object of key-value pairs to override Jinja values in the message. For example, if the message text is |
Important note: If certain values are set to null, Leanplum will return the key as a string. See more details to prevent this issue.
Navigate to the message in the Leanplum dashboard. The number after the last slash in the URL is the ID.
Example: http:// ... /dashboard#/12345__164/messaging/123456789
Your API call should look something like this: