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 documentationGetting StartedFAQAltcraft glossary
      Profiles and databasesarrow
    • Subscription resourcesManaging databasesSubscriber profileProfiles import and data updateCommon Errors When Importing ProfilesScheduled customer data importManaging Data TablesAutomatic data collectionBulk customers profiles updateDouble opt-in subscriptionSuppression listsProfile relationsProfile history exportProfile exportCreating a static segment based on import resultsHow to open a CSV fileMatchingTypes of fields in the databaseGlobal control groupsSubscription Manager
      Communication channelsarrow
      • Email channelarrow
      • Email: ISP interactions best practices
          First mailingarrow
        • Quick StartEmail
        Email: sending domain configurationEmail: setting up and using postmastersHow email tracking works
        Push Channelarrow
        • Mobile Pusharrow
        • First Mobile Push Mailing
            Mobile Push Providersarrow
          • Firebase Cloud MessagingApple Push Notification ServiceHuawei Mobile ServicesRuStoreYandex.AppMetrica
          Integrate your app with Altcraft
            Deprecated: Manual Push Setuparrow
          • Deprecated: Setup and ConnectionProcessing and adding a subscriptionEvent registrationProviders: push message structure
          Web Pusharrow
        • First Web Push MailingResource and Website Setup
            Web Push Providersarrow
          • Firebase Cloud messagingApple SafariMozilla Services
          Transferring Data to the PlatformWeb Push SDK MethodsPWA and Push Notifications
            Migration and Subscription Transferarrow
          • Migrating push subscriptions from third-party servicesHow to transfer push subscriptions configured for Safari?Migration from OneSignal
        SMS channelarrow
      • SMS
        In-Apparrow
      • First In-App PlacementSDK Setup and Integration
      WhatsAppViber*™
        Telegramarrow
      • Telegram BotTelegram Group
        Maxarrow
      • MAX BotMAX Group
      NotifyCommunication Channels WorkflowРуководство: SMS-рассылка через VK NotifyРуководство: SMS-рассылка через УТШРуководство: push-рассылка через сервис от "Согласие"
      Segmentationarrow
    • Static SegmentsDynamic SegmentsUpdatable Segments
        Segmentation Conditionsarrow
      • Segmentation by Profile dataSegmentation by Interactions with EntitiesSegmentation by Activity of the channel
          Segmentation by external dataarrow
        • Segmentation by external dataSegmentation by external SQL tablesRecommendations for segmentation by external data
        Segmentation by Profile structure
      Best Send Time (BST)Logical operators "AND" and "OR"Recommendations for working with segments
      Message templatesarrow
      • Working with message templatesarrow
      • Working in the editorEmail templateSMS templatePush templateTemplate for In-AppMAX templateTelegram templateWhatsApp templateViber templateNotify template
        Visual editor for email-templatearrow
      • Visual editor interfaceAdding blocksElements and their settingsCustom blocksElement stylesLayer manager
      Template fragmentsImage galleryContent personalizationCreating tables based on array elementsBlock editor for email template
        Altcraft Variables and Functionsarrow
      • Logical expressions in messagesLoops in messagesMarket variables in templatesUsing the JSONPath functionality
        Dynamic content in messagesarrow
      • Dynamic HTML contentDynamic JSON contentContent from SQL database in templatesDynamic API content
      Importing and exporting a message templateImporting a template from a third-party serviceExporting a template from Pixcraft
      Mailingsarrow
    • Broadcast mailingsTrigger mailingRegular mailingMultivariate testingMailing testingMailing schedulePlacementsMailings calendarMailing log — errors and troubleshootingManaging the Sender Queue
      Automation scenariosarrow
    • Managing scenariosScenario NodesClassic marketing scenariosStep-by-step welcome scenario guideScenario for automatic notification of the managerAbandoned cart scenarioCycle Handling in Automation ScenariosHigh-priority scenarios
      Campaignsarrow
    • Working with CampaignsLocal control groups (LCG)Stratification violation error when limit is reachedAudience expansion in campaignsAudience building
      Marketarrow
    • Market settings
        Productsarrow
      • How to create a product manuallyHow to import a product from a fileScheduled product importProduct and SKU SegmentsPreparing the YML file
      OrdersMarket variables in message templateGuide: how to send an order confirmation email
      Loyalty programsarrow
    • Loyalty programsLoyalty integration with external systemsCreating a loyalty program from scratchBasic loyalty program use casesOrder SegmentsPromotion codes
      Reports and analyticsarrow
    • Channel reportTraffic report
        Summary reportarrow
      • Summary report metrics
      Cohorts reportLifetime reportFunnels reportGoals reportAudience growth reportClick map reportLoyalty programs reportBounces reportUndeliveries reportReport on global control groups
      Weblayersarrow
      • Formsarrow
        • Create a formarrow
        • General settingsForm customization with custom codeForm constructorAppearanceActions and form publicationConditional logic in forms and surveys
        Data analyticsBinding data channel and formsNPS testing
        Pixelsarrow
      • Goal customer actions and scoring
        Pop-upsarrow
      • Creating and publishing a pop-upSetting up a popup in the code editorManaging pop-ups manually via scriptPopup analyticsGuide: pop-up for push subscriptionsCase: Creating a pop-up with the "Wheel of Fortune" widgetBasic cases of placing a popup via the Tag Manager
        Tag Managerarrow
      • Configuring and installing Tag ManagerTrigger typesVariable typesLinking a pixel and the Tag manager
      Settingsarrow
    • Account settingsCustom linksVirtual sendersSending policiesAudit journalTags FAQ
        Connectionsarrow
      • Connection to Facebook AdsConnection to Google AdsConnecting to Yandex.Audience™Connection to 360dialogConnection to EdnaConnection to Devino TelecomConnection to SMSTrafficConnection to VK Ads™Connection to MTS OmniChannelConnection via OAuth 2.0Basic Authentication connectionToken Authentication connectionCustom Authentication ConnectionConnecting to MAXConnection to NotifyConnection to Rapporto
        Users, groups and accessarrow
      • Password and login securityTwo-Factor Authentication (2FA)
      Attribute settings
      Integrationsarrow
    • Facebook Ads Manager
        Yandexarrow
      • Yandex AppMetricaYandex.Audience™
      Google Ads AudiencesWhatsAppStatic segment synchronizationViberVK AdsNotifyMAX
        Action hooksarrow
      • Lpgenerator™Tilda™Altcraft Action HooksAction hooks event typesEvent Capture Message StructuresJSON batch request (HTTP POST action hook)Message to RabbitMQ brokerMessage to RabbitMQ exchangerMessage to Kafka brokerTest event
        Integration of third-party services using Albatoarrow
      • Connecting Altcraft to Albato Launching the welcome scenario using AlbatoTransmitting event dataSetting up a trigger mailingEvent registrationGoogle Sheets and Altcraft integration AmoCRM and Altcraft integration
        Additional Informationarrow
      • Integration scopeData Transmitted During Synchronization
      API requests: where to startarrow
    • Import or update a profileTrigger mailing launchEngage profile in scenario
      Changelogarrow
    • v2026.3.79v2026.3.78v2026.2.77v2026.1.76v2025.4.75v2025.4.74v2025.3.73v2025.2.72v2025.1.71v2024.4.70v2024.3.69v2024.2.68.2v2024.1.68
    Documentation archiveEmail Marketer's Library
  • Communication channels
  • In-App
  • SDK Setup and Integration

SDK Setup and Integration

To work with the In-App channel, you must integrate Altcraft mSDK into your mobile application. The SDK handles user authentication, channel subscription, retrieving available placements, and displaying In-App content in the application.

mSDK Integration

The mSDK integration procedure depends on the platform. Detailed instructions for each platform are provided in the developer guide: Android, iOS, Flutter, React Native.

Authorization​

The SDK supports two authorization methods — JWT token and role token (rToken):

  • JWT token — required if personalization is needed. Profile matching (search by email, phone, profile_id, and other identifiers) is only possible with JWT. The JWT provider is registered in the SDK before initialization.
  • rToken — a role token bound to a resource. In-App is not tied to the push channel: a role token can be used without integrating push providers. However, with a role token, placements run for all users — personalization is not available.

After creating a resource, a section for managing tokens will be available in its settings:

To create a role token, no public key is required: specify its name, expiration date, and the profile database bound to it:

The role token serves as an access key from the mSDK side to the "resource-database" pair.

To create a JWT token, you need to provide a public key. The platform supports the ES384 algorithm (ECDSA, as the most reliable), as well as RS256, ES256, and ES512 for compatibility with different application libraries:

The application must pass a JWT token to the SDK, which is generated by the client's server-side using the following payload:

{
"iss": "<App Name>",
"exp": <UnixTimeUTC>,
"rtoken": "<RoleToken>",
"matching": "JSONString"
}
  • iss — issuer — unique identifier of the token creator;
  • exp — expiration time — token expiration time as a UNIX timestamp in seconds;
  • rtoken — the role token obtained when setting up the resource in the platform;
  • matching — a string-serialized profile matching object, e.g. {"db_id":2,"email":"registered_db@localhost","matching":"email_profile"}.

For more information on JWT structure and its differences from rToken, see Working with Role and JWT Tokens.

Initialization and In-App Launch​

The basic principle of working with the SDK:

  1. Integrate the mSDK and set up authorization (see above).
  2. Initialize the SDK at application startup: specify the platform API address; for JWT authorization, register the token provider before initialization.
  3. Immediately after initialization, subscribe to activity lifecycle tracking (registerLifecycleTracking()), otherwise In-App notifications that should appear at application startup may be missed.
  4. After initialization, execute in the application: authentication (authenticate()), channel subscription (inAppSubscribe()), placement request (getInAppPlacements()). Use setScreen() to show content only on specific screens.
Always call inAppSubscribe()

Even if an In-App channel subscription has been added manually in the platform interface, you must call inAppSubscribe() in the application. Without it, the SDK will not register the profile for In-App, matching will not work, and personalized placements will not be displayed. Call this function after authentication is complete.

Initialization and Subscription Example (Android)

Initialization in the application class:

class AltcraftApp : Application() {
override fun onCreate() {
super.onCreate()

// Register JWT provider (before SDK initialization)
AltcraftSDK.setJWTProvider(MyJWTProvider())

// Initialize SDK
val config = AltcraftConfiguration.Builder(
apiUrl = "https://<API-domain>",
enableLogging = true
).build()
AltcraftSDK.initialization(context = this, configuration = config)

// Register activity lifecycle for automatic In-App display
AltcraftSDK.inAppFunctions.registerLifecycleTracking(this)
}
}

Authentication, subscription, and placement request in the activity:

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

// Set screen for In-App content filtering
AltcraftSDK.inAppFunctions.setScreen("home")

// Request available In-App placements
AltcraftSDK.inAppFunctions.getInAppPlacements(this)

// Authenticate and subscribe to In-App channel
CoroutineScope(Dispatchers.Main).launch {
AltcraftSDK.authFunctions.authenticate(this@MainActivity)
withTimeoutOrNull(10_000L) {
while (!AltcraftSDK.authFunctions.isAuthenticated(this@MainActivity)) {
delay(100L)
}
}
AltcraftSDK.inAppFunctions.inAppSubscribe(context = this@MainActivity, sync = true)
}
}
}
Initialization and Subscription Example (iOS)

Initialization in AppDelegate.application(_:didFinishLaunchingWithOptions:):

class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Register JWT provider (before SDK initialization)
AltcraftSDK.setJWTProvider(provider: JWTProvider())

// Initialize SDK
AltcraftSDK.shared.initialization()

// Register application lifecycle for automatic In-App display
AltcraftSDK.shared.inAppFunctions.registerLifecycleTracking()

return true
}
}

Authentication, subscription, and placement request:

// Set screen for In-App content filtering
AltcraftSDK.shared.inAppFunctions.setScreen(screen: "home")

// Request available In-App placements
AltcraftSDK.shared.inAppFunctions.getInAppPlacements()

// Authenticate and subscribe to In-App channel
AltcraftSDK.shared.authFunctions.authenticate()
AltcraftSDK.shared.inAppFunctions.inAppSubscribe()

Detailed code examples for each platform are available in the mSDK documentation.

Pitfalls and Common Errors​

  • Incorrect API domain. apiUrl must point to the platform API endpoint (e.g., pxl-*.altcraft.com), not the tracking domain. If the SDK cannot retrieve placements (error 404 No such route or Role Token processing error), check apiUrl.
  • Expired token. The token must be signed with a key added to the resource. A token with an expired date will return a Role Token processing error.
  • db_id in matching must match the database ID bound to the token. Otherwise, the profile will not be found.
  • HTTP requests. For working with the API over an unsecured protocol (dev environments), cleartext traffic must be allowed in the application manifest.
Last updated on Sep 28, 2026
Previous
First In-App Placement
Next
WhatsApp
  • Authorization
  • Initialization and In-App Launch
  • Pitfalls and Common Errors
© 2015 - 2026 Altcraft, LLC. All rights reserved.