React Native User Information

External User ID

Add your custom External User Ids within Reteno by the following method:

import { setUserAttributes } from "reteno-react-native-sdk";

setUserAttributes({
  externalUserId: "USER_ID",
  user,
});

When to send your user ID to Reteno >

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 by the following method:

import { setUserAttributes } from "reteno-react-native-sdk";

setUserAttributes({
    externalUserId: "USER_ID",
    user: {
        attributes: userAttributes,
        subscriptionKeys: string[],
        groupNamesInclude: string[],
        groupNamesExclude: string[]
    }
})

The userAttributes object structure:

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

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

type Fields = Field[];

type UserAttributes = {
  phone?: string | null;
  email?: string | null;
  firstName?: string | null;
  lastName?: string | null;
  languageCode?: string | null;
  timeZone?: string | null;
  address?: Address | null;
  fields?: Fields | null;
};

type User = {
  userAttributes?: UserAttributes | null;
  subscriptionKeys?: String[] | null;
  groupNamesInclude?: String[] | null;
  groupNamesExclude?: String[] | null;
};

type SetUserAttributesPayload = {
  externalUserId: string;
  user: User;
};

📘

Note

Phone

We use Google's libphonenumber library for phone number validation. Send phone numbers in the E164 format. A request with an invalid phone number will not be transmitted. You can validate phone numbers by the link.

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

Anonymous User Attributes

Reteno SDK allows tracking anonymous user attributes. To start tracking information about user without identificator, use setAnonymousUserAttributes function:

function setAnonymousUserAttributes(
  payload: AnonymousUserAttributes
): Promise<void>;

type AnonymousUserAttributes = {
  firstName?: string | null | undefined;
  lastName?: string | null | undefined;
  languageCode?: string | null | undefined;
  timeZone?: string | null | undefined;
  address?: Address | null | undefined;
  fields?: Fields | null | undefined;
};

📘

Note

You can't provide anonymous user attributes with phone or/and email. For that purpose use setUserAttributes method with externalUserId