Expo User Information

External User ID

Add your custom external user ID in Yespo via updateUserAttributes:

import Reteno from 'expo-reteno-sdk';

Reteno.updateUserAttributes({
  externalUserId: 'USER_ID',
  user: {},
});
📘

Note

When a user logs in to the app under a different External User Id, the device together with its push token is re-linked to the corresponding contact, and the previous contact loses this device and token. One contact can have several devices, and a push notification is delivered to all of them. To keep receiving push notifications on several accounts that share the same device, use multi-account user attributes.

User Attributes

User attributes are attributes you define to describe segments of your user base, such as language preference or geographic location.

Add user attributes like phone, email, etc. with:

import Reteno from 'expo-reteno-sdk';

Reteno.updateUserAttributes({
  externalUserId: 'USER_ID',
  user: {
    userAttributes: {
      phone: '+380501234567',
      email: '[email protected]',
      firstName: 'John',
      lastName: 'Doe',
      languageCode: 'en',
      timeZone: 'Europe/Kyiv',
      marketId: 'market-1',
      fields: [{ key: 'plan', value: 'premium' }],
    },
    subscriptionKeys: ['news'],
    groupNamesInclude: ['vip'],
    groupNamesExclude: ['inactive'],
  },
});

The userAttributes object structure:

type UserAddress = {
  region?: string | null;
  town?: string | null;
  address?: string | null;
  postcode?: string | null;
};

type UserCustomField = {
  key: string;
  value: string;
};

type UserAttributes = {
  phone?: string | null;
  email?: string | null;
  firstName?: string | null;
  lastName?: string | null;
  languageCode?: string | null;
  timeZone?: string | null;
  marketId?: string | null;
  address?: UserAddress | null;
  fields?: UserCustomField[] | null;
};

type UserInformationPayload = {
  externalUserId: string;
  user: {
    userAttributes?: UserAttributes;
    subscriptionKeys?: string[];
    groupNamesInclude?: string[];
    groupNamesExclude?: string[];
  };
};

Note

LanguageCode

Data about language in RFC 5646 format. Primary language subtag in ISO 639-1 format is required. Example: de-AT.

TimeZone

Item from TZ database. Example: Europe/Kyiv.

MarketId

External market identifier. Available since Expo SDK v2.1.0. Pass an empty string "" to clear the value on the backend.

Anonymous User Attributes

Reteno SDK allows tracking anonymous user attributes. Use updateAnonymousUserAttributes:

import Reteno from 'expo-reteno-sdk';

Reteno.updateAnonymousUserAttributes({
  firstName: 'Guest',
  lastName: 'User',
  languageCode: 'en',
  timeZone: 'Europe/Kyiv',
  marketId: 'market-1',
  fields: [{ key: 'source', value: 'organic' }],
});

Note: for phone and/or email, use identified user flow with updateUserAttributes and externalUserId.

The AnonymousUserAttributes object also supports marketId since Expo SDK v2.1.0. Pass an empty string "" to clear the value on the backend.

Multi-account User Attributes

If multiple Yespo accounts are used in the same app, use updateMultiAccountUserAttributes:

import Reteno from 'expo-reteno-sdk';

Reteno.updateMultiAccountUserAttributes(
  {
    externalUserId: 'USER_ID',
    user: {
      userAttributes: {
        email: '[email protected]',
      },
    },
  },
  'account_suffix'
);