Creating new users with our API

Our API now includes an optional argument for production methods — createDisposition — which allows you to control whether or not Leanplum automatically creates a new user profile for a non-existing user (based on the user ID you pass in the call).

The createDisposition argument accepts two possible strings:

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

This was a substantial change to many of our API methods. Now you can set whether or not the following calls will create new user IDs for any users that don't exist yet in your app.

🚧

If your API calls rely on Leanplum creating new users, you may need to update them to use createDisposition=CreateIfNeeded (see the table of methods below).

Each API method has its own default setting for the createDisposition option.

Methods that will not create new users by default

MethodDefault for createDisposition
advanceCreateNever
getVarsCreateNever
heartbeatCreateNever
pauseSessionCreateNever
pauseStateCreateNever
resumeSessionCreateNever
resumeStateCreateNever
sendMessageCreateNever
stopCreateNever

Methods that will create new users by default

You can change this behavior by adding createDisposition=CreateNever to the call.

MethodDefault for createDisposition
setDeviceAttributesCreateIfNeeded
setTrafficSourceInfoCreateIfNeeded
setUserAttributesCreateIfNeeded
startCreateIfNeeded
trackCreateIfNeeded