Documentation for version v75
Public SDK API
default export AltcraftSDK
AltcraftSDK
// SDK initialization and configuration setup
├─ function initialize(config: AltcraftConfig): Promise<void>
// Full SDK data cleanup
├─ function clear(): Promise<void>
// Request notification permissions (platform-dependent)
├─ function requestNotificationPermission(): void
// Push subscription (fire-and-forget)
├─ function pushSubscribe(
│ sync?: boolean | null,
│ profileFields?: Record<string, unknown> | null,
│ customFields?: Record<string, unknown> | null,
│ cats?: CategoryData[] | null,
│ replace?: boolean | null,
│ skipTriggers?: boolean | null
│ ): void
├─ function pushSuspend(...): void
└─ function pushUnSubscribe(...): void
// Subscription status (async)
├─ function unSuspendPushSubscription(): Promise<ResponseWithHttpCode | null>
├─ function getStatusOfLatestSubscription(): Promise<ResponseWithHttpCode | null>
├─ function getStatusOfLatestSubscriptionForProvider(provider?: string | null): Promise<ResponseWithHttpCode | null>
└─ function getStatusForCurrentSubscription(): Promise<ResponseWithHttpCode | null>
// SDK events (single JS-side subscriber)
├─ function subscribeToEvents(handler: (event: SdkEvent) => void): void
└─ function unsubscribeFromEvent(): void
// Mobile event sending
└─ function mobileEvent(
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,
utm?: UTM | null
): void
// Push provider token
├─ function setPushToken(provider: string, token: string | null): Promise<void>
└─ function getPushToken(): Promise<TokenData | null>
// Android: pass incoming push payload to SDK
└─ function takePush(message: Record<string, string>): void
// Manual push event registration (delivery / open) on RN side
├─ function deliveryEvent(message?: Record<string, string> | null, messageUID?: string | null): void
└─ function openEvent(message?: Record<string, string> | null, messageUID?: string | null): void
// iOS: write value to UserDefaults / App Group
└─ function setUserDefaultsValue(suiteName: string | null, key: string, value: unknown): void
Event Classes
SdkEvent
// Universal SDK event delivered to JS via NativeEventEmitter.
function: string
code: number | null
message: string
type: 'event' | 'error' | 'retryError'
value?: Record<string, unknown> | null
Exported Types
// Subscription category
export type CategoryData = {
name?: string | null;
title?: string | null;
steady?: boolean | null;
active?: boolean | null;
};
// Device push provider token
export type TokenData = {
provider: string | null;
token: string | null;
};
// Application metadata
export type AppInfo = {
appID: string;
appIID: string;
appVer: string;
};
// API response with HTTP status code
export type ResponseWithHttpCode = {
httpCode: number | null;
response: Response | null;
};
export type Response = {
error?: number | null;
errorText?: string | null;
profile?: ProfileData | null;
};
export type ProfileData = {
id?: string | null;
status?: string | null;
isTest?: boolean | null;
subscription?: SubscriptionData | null;
};
export type SubscriptionData = {
subscriptionId?: string | null;
hashId?: string | null;
provider?: string | null;
status?: string | null;
fields?: { [key: string]: string } | null;
cats?: CategoryData[] | null;
};
// UTM parameter container
export type UTM = {
campaign?: string | null;
content?: string | null;
keyword?: string | null;
medium?: string | null;
source?: string | null;
temp?: string | null;
};
AltcraftConfig
export type AltcraftConfig = {
apiUrl: string;
rToken?: string | null;
appInfo?: AppInfo | null;
providerPriorityList?: string[] | null;
enableLogging?: boolean | null;
// -------- ANDROID-ONLY --------
android_icon?: number | null;
android_usingService?: boolean | null;
android_serviceMessage?: string | null;
android_pushReceiverModules?: string[] | null;
android_pushChannelName?: string | null;
android_pushChannelDescription?: string | null;
};