User Management

Sync users

Before using ROQ’s feature, you need to synchronize some of your user data. This is needed for two reasons:

  1. The user data needs to be present on ROQ Platform side so that user-specific JWT tokens can be created. These tokens are used for secure interaction between your application and ROQ.
  2. The user data is also used to send emails and notifications. For instance, you may want to address your users by their first name in a notification template: Hi {{recipient.firstName}}

It’s your decision which information you wish to synchronize to ROQ. It’s recommended to send the data to ROQ after you store it in your database using the createUser() API:

const roqUser = await client.asSuperAdmin().createUser({
    user: {
        reference: 'abc123',
        email: 'xyz789',
        firstName: 'xyz789',
        lastName: 'xyz789',
        isOptedIn: true,
        active: true,
        locale: "en-US",

ℹ️ It's important to save the returned ID on your side, so that you can use it for other features. To lean more about the parameters, please refer to the createUser() API documentation.