What kind of user ID should I use as a custom user ID in Batch?
Batch allows you to store a Custom User ID that can automatically be tied to several push tokens from different OS' and Apps (web, mobile). This allows you to use the Batch-related features, such as Batch APIs (Profile API, Campaign API, etc.), import Audiences, etc.
The Custom User ID you communicate with Batch should be a unique ID that you use to identify your users across different tools and databases in your technical ecosystem. This ID will allow you to connect your other tools (internal and external) with Batch.
If you are wondering which ID you should use as a custom user identifier, here are a few examples:
Login System
If you have a login system, you probably have a unique user ID associated with the user's account. Simply set this ID as your user identifier, and don't forget to reset it (by setting it to nil) when the user logs out.
While email addresses are an appropriate identifier, we suggest you hash them before setting them as your identifier, for privacy reasons.
PaaS Datastore
Your data store probably has a stable ID associated with your installation. You just need to make sure it is unique between installations, and you can easily retrieve it from your backend code.
Specific Backend And Database
Anything that can identify a user uniquely will work. Email address, phone number, etc. We suggest you hash this information before setting it up and using the same hash on your backend.
Otherwise, you will need to create a stable identifier for your app installation and send it to your backend. The most common way to do that is to generate an RFC4122 UUID.
Last updated
Was this helpful?