getUser

Get the details of a connected user.

Description

Get the details of the connected user.

Response

Returns a Promise containing a user object. Example:

{
  user: {
    cellphone: '',
    creation_date: '2016-03-17T00:00:00Z',
    email: '[email protected]',
    external_id: '[email protected]',
    firstname: 'User',
    id: '2994735',
    language: '',
    lastname: 'Test',
    list_ids: '3,4,9,14,46',
    universe: 'pophat',
  },
  loyalty: {
    birthday: null,
    card_code: '7727943928884',
    card_expiration_date: '9998-12-31 00:00:00',
    custom_fields: [
      {
        name: 'c9',
        value: 'A custom field value',
      },
    ],
    id: 1502274,
    id_individual: 2994746,
    id_program: 1,
    id_tier: 8,
    nq_points: 0,
    pending: {
      nq_points: {
        next_movement: {
          date: '2023-01-22 11:15:28',
          value: 66,
        },
        total: 6464,
      },
      q_points: {
        next_movement: {
          date: '2023-01-22 15:46:04',
          value: 431,
        },
        total: 431,
      },
    },
    program_join_date: '2022-06-10 10:56:57',
    q_points: 0,
    remaining: {
      nq_points: {
        next_movement: null,
        total: 0,
      },
      q_points: {
        next_movement: null,
        total: 48,
      },
    },
    tier_join_date: '2022-06-10 10:56:57',
    tiers: [], // list of all the tiers of your loyalty program. You can access it by the getTiers() method also.
  },
  universe: 'pophat',
};

Code example

splioSDK.getUser().then((user) => {
  console.log("You're a member of our loyalty program since", user.loyalty.program_join_date);
});