Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guide iconUser guide
Developer guide iconDeveloper guide
Admin guide iconAdmin guide
English
  • Русский
  • English
Login
    User API documentationAPI interactionMatching
      Profilesarrow
    • Import profileUpdate profileImport multiple profilesUpdate multiple profilesAdd multiple profilesAdd profile to databaseImport profile to RabbitMQGet profile dataUploading profiles to a fileDelete profileSubscription fields functional updateDatabase fields functional updateMerging multiple profilesUnsubscribe profile from resourceProfile splitting
        Subscriptionsarrow
      • Add or edit subscriptionGet all profile subscriptionsGet all subscriptions from multiple profilesGet profile subscriptionDelete profile subscriptionRestore deleted subscriptionSuspend all subscriptionsUnsuspend all suspended subscriptions
        Action historyarrow
      • Get profile action historyGet multiple profiles action history
        Profile relationsarrow
      • Attach relationDetach relationModify relation propertiesOverwrite relation propertiesGet profile relations infoGet profile relations info
      Get data for multiple profiles
      Databasesarrow
    • Get database statisticsUpdate statistics on databaseGet database listGet database informationGet database fieldsDatabase wipe
      Resourcesarrow
    • Get resource statisticsUpdate statistics on resourceGet resources listGet resource informationGet resource subscription fields
      Segmentsarrow
    • Create segmentGet statistics on resourceUpdate statistics on segmentAdd or remove profileGet profile data in a static segmentUpdate segmentGet segment informationGet segments listDelete segment
      Suppression listsarrow
    • Create suppression listUpdate suppression listGet suppression list infoGet the list of suppression listsDelete suppression listUpload suppression list data to file
        Suppression list actionsarrow
      • Check if email is suppressedAdd email to suppression listAdd multiple emails to suppression listRemove email from suppression listRemove all emails from suppression listCheck if domain is suppressedAdd domain to suppression listAdd multiple domains to suppression listRemove domain from suppression listRemove all domains from suppression listCheck if phone number is suppressedAdd phone number to suppression listAdd multiple phones to suppression listRemove phone number from suppression listRemove all phone numbers from suppression list
      Templates and fragmentsarrow
    • Get templates listGet template infoDelete templateAdd templateUpdate templateChannel object
      Campaignsarrow
    • Get campaign informationGet campaign listActivate campaignComplete campaignDeactivate campaignGet campaign status
      Mailingsarrow
    • Activate mailingDeactivate mailingGet mailing listGet mailing informationGet mailing logClone mailingDelete mailingGet mailing status
        Broadcast mailingsarrow
      • Get broadcasts listGet broadcast informationCreate broadcast mailingUpdate broadcast mailingLaunch a broadcast mailing
        Regular mailingsarrow
      • Get regular mailings listGet regular mailing informationCreate regular mailingUpdate regular mailingLaunch a regular mailing
        Trigger mailingsarrow
      • Get trigger mailings listGet trigger mailing informationCreate trigger mailingUpdate trigger mailingTrigger launch (API call)Profile import + trigger mailing launchTask for bulk trigger launchTask for bulk profiles import + trigger launchBulk trigger launchBulk profiles import + trigger mailing launchClone a trigger mailingData array
      Automation scenariosarrow
    • Engage profile in scenarioImport and engage profile in scenarioBatch import and engage profiles in a scenarioTask for batch import and engaging profiles in the scenarioGet scenarios listActivate scenarioDeactivate scenarioGet scenario informationChange scenario priority
      Loyalty Programsarrow
    • Get profile tier in a loyalty programExport points transactionsExpiring points for a periodGet profile account transactionsGet trigger promotions listAccrue points to a memberRedeem member pointsCommit temporary transactionPreliminary Order CalculationOrder ConfirmationRoll back temporary transactionCancel points transactionGet points account balanceRegister member in a loyalty programBatch adding participants to loyalty programTask for batch add participants to loyalty programRemove member from loyalty program
      Formsarrow
    • Get form informationGet form listExport form fill data by userExport form fill dataPublish formUnpublish formDelete form
      Promo codesarrow
    • Import promo codesGet promo code informationActivate promo codeUpdate promo codeAttach promo codeDetach promo codeGet all promo codes
      Goalsarrow
    • Goals and goal values registration
      Application push notificationsarrow
    • Processing and adding a subscriptionAdd app push events
      Marketarrow
      • Market objectsarrow
      • Order data objectProduct data objectSKU data objectCategories arrayCustom fields array
        Ordersarrow
      • Import order and item statusesGet orders listDelete orderGet order statusUpdate order line status
        Products and SKUarrow
      • Import products, SKUs and categoriesImport SKUs and categoriesGet products listGet SKUs listDelete productsDelete SKU
      Analytic reportsarrow
    • Get summary reportGet soft bounces reportGet undeliveries report
      Sendersarrow
    • Get senders list
        Virtual senders (Smart accounts only)arrow
      • Get virtual senders listGet virtual sender informationClone virtual senderCreate virtual senderUpdate virtual senderDelete virtual sender
      External datatables queriesarrow
      • Segmentation queriesarrow
      • Add segmentation queryUpdate segmentation queryGet segmentation query informationGet segmentation queries listDelete segmentation query
        Template queriesarrow
      • Add template queryUpdate template queryGet template query informationGet template queries listDelete template query
      Objectsarrow
    • AKMTA objectContent objectCustom channels rulesEmail rule objectFile objectProfile data objectSMS rule objectSender objectSender typesStart schedule objectSubscription objectTrigger types
      Miscellaneousarrow
    • Upload fileGet message web versionPush providersDeduplication of requestsHow to send API request with RabbitMQList of gender identificationsObtain valid values for fields: browsers, devices, tz, oses, languages
    Importing the API collection in PostmanList of API endpoints
      SDKarrow
      • mSDKarrow
        • Androidarrow
        • Quick startSDK functionalitySDK ConfigurationPublic SDK API
            Provider setuparrow
          • Firebase Cloud MessagingHuawei Mobile ServicesRuStore
          iOSarrow
        • Quick startSDK configurationSDK functionalityPublic SDK API
            Provider configurationarrow
          • Apple Push Notification ServiceFirebase Cloud MessagingHuawei Mobile Services
          React Native (Android/iOS)arrow
        • Quick startSDK configurationSDK functionalityPublic SDK APIProvider setup
          Flutter (Android/iOS)arrow
        • Quick StartSDK ConfigurationSDK FunctionalitySDK Public APIProvider Setup
        Working with role and JWT tokens
      Web Push SDK
  • SDK
  • mSDK
  • React Native (Android/iOS)
  • Public SDK API

Public SDK API

The SDK is split into modules. Each module is a separate npm package with its own API class, and the @altcraft/react-native-sdk package provides the AltcraftSDK wrapper class with the same methods on top of the modules.

// @altcraft/react-native-sdk — wrapper with the entire API
AltcraftSDK

// @altcraft/core
AltcraftCore
├─ static initialize(config: AltcraftConfig): Promise<void>
├─ static subscribeToEvents(handler: (event: SdkEvent) => void): void
├─ static unsubscribeFromEvents(handler: (event: SdkEvent) => void): void
├─ static clear(): Promise<void>
├─ static setJwtProvider(provider: () => Promise<string | null>): void
├─ static authenticate(): void
├─ static logOut(): void
├─ static isAuthenticated(): Promise<boolean>
├─ static setAppGroup(groupName: string | null): void
├─ static setUserDefaultsValue(suiteName: string | null, key: string, value: string | null): void
├─ static unlockInitialOperationsInThisSession(): void
└─ static readonly moduleEvents: CoreModuleEvents

// @altcraft/push
AltcraftPush
├─ static pushSubscribe(options?: PushSubscribeOptions): Promise<void>
├─ static pushSuspend(options?: PushSubscribeOptions): Promise<void>
├─ static pushUnSubscribe(options?: PushSubscribeOptions): Promise<void>
├─ static unSuspendPushSubscription(): Promise<ResponseWithHttpCode | null>
├─ static getStatusOfLatestSubscription(): Promise<ResponseWithHttpCode | null>
├─ static getStatusForCurrentSubscription(): Promise<ResponseWithHttpCode | null>
├─ static getStatusOfLatestSubscriptionForProvider(provider?: string | null): Promise<ResponseWithHttpCode | null>
├─ static getPushToken(): Promise<TokenData | null>
├─ static setPushToken(provider: string, token: string | null): void
├─ static forcedTokenUpdate(): Promise<void>
├─ static deleteDeviceToken(provider: string): Promise<void>
├─ static changePushProviderPriorityList(priorityList: string[]): Promise<void>
├─ static takePush(message: Record<string, string>): void
├─ static isAltcraftPush(message: Record<string, string>): boolean
├─ static requestNotificationPermission(): Promise<boolean>
├─ static deliveryEvent(options?: PushEventOptions): void
├─ static openEvent(options?: PushEventOptions): void
└─ static readonly moduleEvents: PushModuleEvents

// @altcraft/inapp
AltcraftInApp
├─ static inAppSubscribe(options?: InAppSubscribeOptions): Promise<void>
├─ static inAppUnsubscribe(options?: InAppSubscribeOptions): Promise<void>
├─ static setScreen(screen: string): void
├─ static trigger(name: string): void
├─ static getPlacements(): void
├─ static setAnimation(config: InAppAnimationConfig | null): void
├─ static clearAnimation(): void
├─ static readonly jsonContent: JsonContentApi
└─ static readonly moduleEvents: InAppModuleEvents

// @altcraft/target
AltcraftTarget
├─ static sendTarget(options: MobileEventOptions): void
└─ static readonly moduleEvents: TargetModuleEvents

// @altcraft/profile
AltcraftProfile
├─ static updateProfileFields(options?: UpdateProfileOptions): void
└─ static readonly moduleEvents: ProfileModuleEvents
Error handling

The methods return Promise<void> or Promise<T | null> and do not expose the server response directly. Native call errors arrive as AltcraftException. Read the server result of operations and retry errors through subscribeToEvents().


Core​

Initialization​

initialize(config)

static initialize(config: AltcraftConfig): Promise<void>

Initializes the SDK with the given configuration. Called once at application startup, before the main SDK operations are performed.

ParameterTypeDescription
configAltcraftConfigConfiguration object. The apiUrl field is required.

Returns: Promise<void>.
Throws: AltcraftException with the codes ALTCRAFT_INIT_INVALID_CONFIG, ALTCRAFT_INIT_ERROR, SDK_ERROR.

import { AltcraftConfigBuilder } from '@altcraft/core';
import { AltcraftSDK } from '@altcraft/react-native-sdk';
import '@altcraft/push';

await AltcraftSDK.initialize(
new AltcraftConfigBuilder({ apiUrl: 'https://pxl-demo.altcraft.com' })
.pushConfig({ providerPriority: ['android-firebase'] })
.build()
);

clear()

static clear(): Promise<void>

Clears SDK data on the native side: local storage, saved tokens and pending operations. Cancels background tasks awaiting execution.


SDK events​

subscribeToEvents(handler)

static subscribeToEvents(handler: (event: SdkEvent) => void): void

Subscribes a handler to native SDK events. Several handlers can listen to the same event source.

unsubscribeFromEvents(handler)

static unsubscribeFromEvents(handler: (event: SdkEvent) => void): void

Unsubscribes a specific handler. Pass the same function you used for the subscription.

import { AltcraftSDK, type SdkEvent } from '@altcraft/react-native-sdk';

const handler = (event: SdkEvent) => {
console.log(`[${event.type}] ${event.function}: ${event.message}`);
};

AltcraftSDK.subscribeToEvents(handler);

// Unsubscribe
AltcraftSDK.unsubscribeFromEvents(handler);

Events are identified by the string message and the type. Ready-made message constants are available in the module catalogs: AltcraftCore.moduleEvents, AltcraftPush.moduleEvents, AltcraftInApp.moduleEvents, AltcraftTarget.moduleEvents, AltcraftProfile.moduleEvents. Example:

import { AltcraftSDK } from '@altcraft/react-native-sdk';
import { AltcraftPush } from '@altcraft/push';

AltcraftSDK.subscribeToEvents((event) => {
if (event.message === AltcraftPush.moduleEvents.subscribeRequestSuccessful) {
// The subscription is created
}
});

The full list of messages is available in Full list of SDK events in the "SDK functionality" article.


Authentication​

setJwtProvider(provider)

static setJwtProvider(provider: () => Promise<string | null>): void

Registers the JWT provider: the native side calls the passed function at the moment a request requiring authorization is executed and adds the received token to the header.

ParameterTypeDescription
provider() => Promise<string | null>Function that returns the current JWT token or null.

Register the provider before the initialize() call and before the first operation that requires authorization.

AltcraftSDK.setJwtProvider(async () => await myBackend.getJwtToken());

authenticate()

static authenticate(): void

Starts authorization with the current JWT: the SDK obtains the token through the provider, performs an authorization request and switches the profile to the user from the token.

logOut()

static logOut(): void

Ends the user session: the SDK clears the profile data and starts an anonymous session.

isAuthenticated()

static isAuthenticated(): Promise<boolean>

Returns true if the SDK is authenticated and works with the user profile.

const isAuthenticated = await AltcraftSDK.isAuthenticated();

if (!isAuthenticated) {
AltcraftSDK.setJwtProvider(async () => await myBackend.getJwtToken());
AltcraftSDK.authenticate();
}

Native storage​

setAppGroup(groupName)

static setAppGroup(groupName: string | null): void

Sets the App Group for the iOS SDK — the UserDefaults space shared between the application and the Notification Service Extension. On Android the method is a no-op; on iOS groupName must not be null.

setUserDefaultsValue(suiteName, key, value)

static setUserDefaultsValue(
suiteName: string | null,
key: string,
value: string | null
): void

Stores a string value: UserDefaults on iOS (with the specified suite) and the SDK SharedPreferences on Android (the suiteName parameter is ignored). value = null deletes the key.

unlockInitialOperationsInThisSession()

static unlockInitialOperationsInThisSession(): void

Unlocks initial operations in the current session of the Android application. On iOS the method is a no-op.


Push​

Push subscription​

pushSubscribe() / pushSuspend() / pushUnSubscribe()

type PushSubscribeOptions = {
sync?: boolean | null;
profileFields?: Record<string, unknown> | null;
customFields?: Record<string, unknown> | null;
cats?: CategoryData[] | null;
replace?: boolean | null;
skipTriggers?: boolean | null;
};
MethodSubscription statusSuccess / error messages
pushSubscribe()subscribedsuccessful request: push/subscribe / failed request: push/subscribe
pushSuspend()suspendedsuccessful request: push/suspend / failed request: push/suspend
pushUnSubscribe()unsubscribedsuccessful request: push/unsubscribe / failed request: push/unsubscribe
ParameterTypeDescription
syncboolean?true — synchronous request on the SDK side; false — asynchronous; null — the native side default behavior.
profileFieldsRecord<string, unknown>?Profile fields. Values must be JSON-compatible.
customFieldsRecord<string, unknown>?Custom subscription fields. Scalar values are recommended.
catsCategoryData[]?Subscription categories.
replaceboolean?When true, the SDK can replace existing subscriptions with the same push token.
skipTriggersboolean?When true, the profile is ignored in mailing and scenario triggers.

Returns: Promise<void> — the command is accepted by the bridge and the native SDK. The server result arrives through subscribeToEvents().

import { AltcraftSDK } from '@altcraft/react-native-sdk';

await AltcraftSDK.pushSubscribe({
sync: true,
profileFields: { _fname: 'Ivan', _lname: 'Petrov' },
customFields: { source: 'rn_app' },
cats: [{ name: 'developer_news', active: true }],
});

unSuspendPushSubscription()

static unSuspendPushSubscription(): Promise<ResponseWithHttpCode | null>

Resumes a suspended push subscription. Used for LogIn/LogOut transitions between profiles. Returns null if the native SDK did not return a response.

const result = await AltcraftSDK.unSuspendPushSubscription();

if (result == null) {
AltcraftSDK.pushSubscribe({ sync: true });
} else {
const subscription = result.response?.profile?.subscription ?? null;

if (result.httpCode === 200 && subscription == null) {
AltcraftSDK.pushSubscribe({ sync: true });
}
}

Subscription status​

getStatusOfLatestSubscription() — status of the latest profile subscription.

getStatusForCurrentSubscription() — subscription status for the current push token and provider.

getStatusOfLatestSubscriptionForProvider(provider?) — status of the latest subscription by provider. If provider is not specified, the provider of the current token is used.

static getStatusOfLatestSubscription(): Promise<ResponseWithHttpCode | null>
static getStatusForCurrentSubscription(): Promise<ResponseWithHttpCode | null>
static getStatusOfLatestSubscriptionForProvider(
provider?: string | null
): Promise<ResponseWithHttpCode | null>

Returns: Promise<ResponseWithHttpCode | null> — null if there is no response. If response.error != 0, the server returned an error.

const result = await AltcraftSDK.getStatusForCurrentSubscription();

if (result?.response?.error) {
console.log('Status error:', result.response.errorText);
} else {
console.log(result?.response?.profile?.subscription?.status);
}

Push tokens​

getPushToken()

static getPushToken(): Promise<TokenData | null>

Returns the current device push token data and the provider, or null if the token is unavailable.

setPushToken(provider, token)

static setPushToken(provider: string, token: string | null): void

Sets or clears the push token for the specified provider. token = null clears the token.

ParameterTypeDescription
providerstringProvider identifier: android-firebase, android-huawei, android-rustore, ios-apns, ios-firebase, ios-huawei.
tokenstring | nullToken value. null — clears the token.

forcedTokenUpdate() — forced push token update.

deleteDeviceToken(provider) — deletes the device token for a provider.

changePushProviderPriorityList(priorityList) — changes the provider priority for the application runtime. Index 0 is the highest priority provider. The initial list is set in pushConfig({ providerPriority: [...] }).

await AltcraftSDK.changePushProviderPriorityList([
'android-firebase',
'android-huawei',
'android-rustore',
]);

Push notification handling​

requestNotificationPermission()

static requestNotificationPermission(): Promise<boolean>

Requests notification permission: POST_NOTIFICATIONS on Android 13+ (on earlier versions it returns true immediately), UNUserNotificationCenter authorization on iOS.

takePush(message)

static takePush(message: Record<string, string>): void

Passes an incoming push payload to the SDK. On Android the payload goes through the common SDK pipeline: the provider is determined, the delivery event is sent, the notification is built and shown. On iOS the SDK builds a local notification from the _title and _body payload fields.

isAltcraftPush(message)

static isAltcraftPush(message: Record<string, string>): boolean

Checks whether the push message belongs to Altcraft. On iOS the method always returns false.

deliveryEvent(options?) / openEvent(options?)

type PushEventOptions = {
message?: Record<string, string> | null;
messageUID?: string | null;
};

Manual registration of push notification delivery and opening. On Android the events are sent to the platform; on iOS the methods are no-ops.

AltcraftSDK.deliveryEvent({
message: { _uid: 'push-message-uid-0001', _provider: 'android-firebase' },
messageUID: 'push-message-uid-0001',
});

AltcraftSDK.openEvent({
messageUID: 'push-message-uid-0001',
});

You can pass only message or only messageUID. If both values are missing, the SDK cannot identify the push message.


In-App​

In-App subscription​

inAppSubscribe() / inAppUnsubscribe()

type InAppSubscribeOptions = {
sync?: boolean | null;
profileFields?: Record<string, unknown> | null;
customFields?: Record<string, unknown> | null;
cats?: CategoryData[] | null;
replace?: boolean | null;
skipTriggers?: boolean | null;
};

The parameters match the push subscription parameters. Messages: successful request: inapp/subscribe / failed request: inapp/subscribe and successful request: inapp/unsubscribe / failed request: inapp/unsubscribe.

import { AltcraftSDK } from '@altcraft/react-native-sdk';

await AltcraftSDK.inAppSubscribe({ sync: true });

Showing In-App campaigns​

setScreen(screen)

Sets the current application screen. The SDK uses this value to match In-App campaign placements that are configured to be shown on a specific screen.

trigger(name)

Fires an In-App trigger by name.

getPlacements()

Requests available In-App placements from the server. Needed when automatic requests are disabled in inAppConfig({ inAppAutoRequest: false }).

AltcraftSDK.setScreen('catalog');
AltcraftSDK.trigger('add_to_cart');
AltcraftSDK.getPlacements();

In-App campaign animation​

setAnimation(config)

type InAppAnimationSpec = {
durationMs?: number | null; // default 350
delayMs?: number | null; // default 0
easing?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | null;
alphaFrom?: number | null;
alphaTo?: number | null;
translateXFrom?: number | null;
translateXTo?: number | null;
translateYFrom?: number | null;
translateYTo?: number | null;
scaleXFrom?: number | null;
scaleXTo?: number | null;
scaleYFrom?: number | null;
scaleYTo?: number | null;
rotationFrom?: number | null;
rotationTo?: number | null;
};

type InAppAnimationConfig = {
default?: InAppAnimationSpec | null;
campaigns?: { [campaignId: string]: InAppAnimationSpec | null } | null;
};

static setAnimation(config: InAppAnimationConfig | null): void

The animation is applied when an In-App campaign is shown: the native side animates the real native view from the *From values to the *To values. null means the neutral state (opacity 1, offset 0, scale 1, rotation 0). Closing animation is not supported.

Matching rules: a campaigns entry for a specific campaign takes precedence over default; null for a campaign disables the animation; campaigns without a match are shown without animation.

AltcraftSDK.setAnimation({
default: {
alphaFrom: 0,
alphaTo: 1,
translateYFrom: 24,
translateYTo: 0,
durationMs: 350,
easing: 'easeInOut',
},
campaigns: {
'42': { scaleXFrom: 0.8, scaleYFrom: 0.8, alphaFrom: 0, alphaTo: 1 },
'43': null, // campaign 43 is shown without animation
},
});

clearAnimation()

static clearAnimation(): void

Disables the In-App campaign display animation.


In-App JSON content​

type JsonContentHandler = (json: string) => void;

type JsonContentApi = {
subscribe(handler: JsonContentHandler): void;
unsubscribe(): void;
};

static readonly jsonContent: JsonContentApi

Campaigns with the JSON content type are not displayed by the SDK: the application receives the raw campaign JSON and renders it itself. The native side supports a single subscriber, so a new subscribe() call replaces the previous handler.

AltcraftSDK.jsonContent.subscribe((json) => {
const campaign = JSON.parse(json);
// Rendering the campaign with application tools
});

AltcraftSDK.jsonContent.unsubscribe();

Target​

Mobile events​

sendTarget(options)

type MobileEventOptions = {
sid: string;
eventName: string;
sendMessageId?: string | null;
payload?: Record<string, unknown> | null;
matching?: Record<string, unknown> | null;
matchingType?: string | null;
profileFields?: Record<string, unknown> | null;
subscription?: Subscription | null;
utm?: UTM | null;
};

static sendTarget(options: MobileEventOptions): void

Registers an Altcraft mobile event.

ParameterTypeDescription
sidstringPixel identifier. Must not be empty.
eventNamestringEvent name. Must not be empty.
sendMessageIdstring?SMID of the sent message.
payloadRecord<string, unknown>?Event data, JSON-compatible values.
matchingRecord<string, unknown>?Matching data, for example { email: 'ivan.petrov@example.com' }.
matchingTypestring?Matching type.
profileFieldsRecord<string, unknown>?Profile fields.
subscriptionSubscription?Channel subscription, created by a factory function.
utmUTM?UTM tags.
import {
AltcraftSDK,
emailSubscription,
} from '@altcraft/react-native-sdk';

AltcraftSDK.sendTarget({
sid: 'pixel-100000000000000000000000',
eventName: 'purchase',
payload: { order_id: 'A-1001', amount: 3990, currency: 'RUB' },
utm: { source: 'rn_app', medium: 'push', campaign: 'summer_campaign' },
subscription: emailSubscription({
resourceId: 10,
email: 'user@example.com',
status: 'subscribed',
cats: ['promo'],
}),
});

Profile​

updateProfileFields(options?)

type UpdateProfileOptions = {
profileFields?: Record<string, unknown> | null;
skipTriggers?: boolean | null;
};

static updateProfileFields(options?: UpdateProfileOptions): void

Updates profile fields on the server.

ParameterTypeDescription
profileFieldsRecord<string, unknown>?Map of profile fields to update.
skipTriggersboolean?When true, the profile is ignored in mailing and scenario triggers.
import { AltcraftSDK } from '@altcraft/react-native-sdk';

AltcraftSDK.updateProfileFields({
profileFields: { _fname: 'Ivan', _lname: 'Petrov' },
skipTriggers: false,
});

Data models​

AltcraftConfig and AltcraftConfigBuilder
type AltcraftConfig = {
apiUrl: string;
rToken?: string | null;
appInfo?: AppInfo | null;
enableLogging?: boolean | null;
moduleConfigs?: string | null;
};

type AppInfo = {
appID: string;
appIID: string;
appVer: string;
};

class AltcraftConfigBuilder {
constructor(core: {
apiUrl: string;
rToken?: string | null;
appInfo?: AppInfo | null;
enableLogging?: boolean | null;
});

addModule(moduleId: string, config: Record<string, unknown>): this;

build(): AltcraftConfig;
}

The builder mirrors the native AltcraftConfiguration.Builder: common parameters are set in the constructor, module configurations are added by the pushConfig() and inAppConfig() extension methods, which are available when the corresponding package is imported. The core passes the module map to the native side in the moduleConfigs field without interpreting its content.

PushConfig and InAppConfig
type PushConfig = {
providerPriority?: string[] | null;
icon?: number | null; // Android-only
iconName?: string | null; // Android-only
pushReceiverModules?: string[] | null; // Android-only
pushChannelName?: string | null; // Android-only
pushChannelDescription?: string | null; // Android-only
};

type InAppConfig = {
inAppAutoRequest?: boolean | null;
placementsRequestIntervalMs?: number | null;
maxPlacements?: number | null;
};
FieldTypeDescription
PushConfig.providerPrioritystring[]?Provider priority. Index 0 is the highest priority.
PushConfig.iconnumber?Notification icon resource ID (Android). Takes precedence over iconName.
PushConfig.iconNamestring?Notification icon resource name (Android): drawable, then mipmap.
PushConfig.pushReceiverModulesstring[]?Packages with AltcraftPushReceiver implementations (Android).
PushConfig.pushChannelNamestring?Notification channel name (Android).
PushConfig.pushChannelDescriptionstring?Notification channel description (Android).
InAppConfig.inAppAutoRequestboolean?Automatic placement requests. Defaults to true.
InAppConfig.placementsRequestIntervalMsnumber?Interval between automatic requests in milliseconds. Defaults to 30 minutes, minimum 15 minutes.
InAppConfig.maxPlacementsnumber?Maximum number of placements in local storage. Defaults to 500.
SdkEvent
type SdkEvent = {
function: string;
code: number | null;
message: string;
type: 'event' | 'error' | 'retryError';
value?: Record<string, unknown> | null;
timestamp?: string | null;
};
FieldTypeDescription
functionstringName of the SDK function that raised the event.
codenumber | nullHTTP response code if the event is related to a request.
messagestringEvent message — the main event identifier.
type'event' | 'error' | 'retryError'Event type.
valueRecord<string, unknown>?Additional data, for example response_with_http_code.
timestampstring?Timestamp in yyyy-MM-dd HH:mm:ss.SSS format.
TokenData and ResponseWithHttpCode
type TokenData = {
provider: string;
token: string;
};

type ResponseWithHttpCode = {
httpCode: number;
response: {
error?: number | null;
errorText?: string | null;
profile?: {
id?: string | null;
status?: string | null;
isTest?: boolean | null;
subscription?: {
subscriptionId?: string | null;
hashId?: string | null;
provider?: string | null;
status?: string | null;
fields?: Record<string, string> | null;
cats?: CategoryData[] | null;
} | null;
} | null;
} | null;
};
FieldTypeDescription
TokenData.providerstringProvider identifier.
TokenData.tokenstringPush token value.
ResponseWithHttpCode.httpCodenumberHTTP response code.
ResponseWithHttpCode.response.errornumber?Internal server error code (0 — no errors).
ResponseWithHttpCode.response.errorTextstring?Error text.
ResponseWithHttpCode.response.profile.subscription.statusstring?Status: subscribed, suspended, unsubscribed.
CategoryData
type CategoryData = {
name?: string | null;
title?: string | null;
steady?: boolean | null;
active?: boolean | null;
};

Subscription category. When a push request is sent, only the name and active fields are used; title and steady are filled in SDK responses.

Subscription and UTM
type EmailSubscription = {
type: 'email';
resourceId: number;
email: string;
status?: string | null;
priority?: number | null;
customFields?: Record<string, unknown> | null;
cats?: string[] | null;
};

type SmsSubscription = {
type: 'sms';
resourceId: number;
phone: string;
status?: string | null;
priority?: number | null;
customFields?: Record<string, unknown> | null;
cats?: string[] | null;
};

type PushSubscription = {
type: 'push';
resourceId: number;
provider: string;
subscriptionId: string;
status?: string | null;
priority?: number | null;
customFields?: Record<string, unknown> | null;
cats?: string[] | null;
};

type CcDataSubscription = {
type: 'cc_data';
resourceId: number;
channel: string;
ccData: Record<string, unknown>;
status?: string | null;
priority?: number | null;
customFields?: Record<string, unknown> | null;
cats?: string[] | null;
};

type Subscription =
| EmailSubscription
| SmsSubscription
| PushSubscription
| CcDataSubscription;

Factory functions: emailSubscription(), smsSubscription(), pushSubscription(), ccDataSubscription(). The subscription object can also be assembled manually — the only requirement is that the type field matches the channel type.

import { pushSubscription } from '@altcraft/react-native-sdk';

const subscription = pushSubscription({
resourceId: 10,
provider: 'android-firebase',
subscriptionId: 'provider-sub-id',
status: 'subscribed',
});
type UTM = {
source?: string | null;
medium?: string | null;
campaign?: string | null;
content?: string | null;
keyword?: string | null;
temp?: string | null;
};

ActionFieldBuilder​

class ActionFieldBuilder {
constructor(key: string);

set(value: unknown): ActionFieldEntry;
unset(value: unknown): ActionFieldEntry;
incr(value: unknown): ActionFieldEntry;
add(value: unknown): ActionFieldEntry;
delete(value: unknown): ActionFieldEntry;
upsert(value: unknown): ActionFieldEntry;
}

function actionField(key: string): ActionFieldBuilder;

A builder for structured management of profile fields. It produces an object compatible with the native SDK: merge the result with profileFields before passing it to pushSubscribe(), updateProfileFields() or a mobile event.

MethodDescription
set(value)Set the field to the given value.
unset(value)Delete the field value.
incr(value)Increase a numeric field by the given value.
add(value)Add a value to a set/array field.
delete(value)Remove a value from a set/array field.
upsert(value)Set the field if it is missing; update it if it exists.
import { actionField } from '@altcraft/core';
import { AltcraftSDK } from '@altcraft/react-native-sdk';

const profileFields = {
...actionField('_fname').set('Ivan'),
...actionField('login_count').incr(1),
...actionField('visited_pages').add('/settings'),
};

AltcraftSDK.updateProfileFields({ profileFields });

Exceptions​

class AltcraftException extends Error {
readonly code: string;
}

The exception thrown by SDK modules on native call errors. Check code.

CodeDescription
ALTCRAFT_INIT_INVALID_CONFIGInvalid SDK configuration.
ALTCRAFT_INIT_ERRORSDK initialization error.
SDK_ERRORGeneric native bridge error.
import { AltcraftException } from '@altcraft/core';

try {
await AltcraftSDK.initialize(config);
} catch (e) {
if (e instanceof AltcraftException) {
console.log(`SDK error (${e.code}): ${e.message}`);
}
}

Constants​

Push notification providers:

ProviderValue
FCM (Android)android-firebase
HMS (Android)android-huawei
RuStore (Android)android-rustore
APNS (iOS)ios-apns
FCM (iOS)ios-firebase
HMS (iOS)ios-huawei

Subscription statuses:

StatusValue
Subscribedsubscribed
Unsubscribedunsubscribed
Suspendedsuspended
Last updated on Nov 26, 2026
Previous
SDK functionality
Next
Provider setup
  • Core
    • Initialization
    • SDK events
    • Authentication
    • Native storage
  • Push
    • Push subscription
    • Subscription status
    • Push tokens
    • Push notification handling
  • In-App
    • In-App subscription
    • Showing In-App campaigns
    • In-App campaign animation
    • In-App JSON content
  • Target
    • Mobile events
  • Profile
  • Data models
  • ActionFieldBuilder
  • Exceptions
  • Constants
© 2015 - 2026 Altcraft, LLC. All rights reserved.