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 updateScheduled customer data importAutomatic 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 practicesEmail: sending domain configurationEmail: setting up and using postmastersБыстрый старт
        Push channelarrow
        • Mobile Pusharrow
        • Settings & implementation
            Integrate your app with Altcraftarrow
          • Providers: push message structureProcessing and adding a subscriptionEvent registration
          Web pusharrow
        • Preliminary Settings
            Web browser push configurationarrow
          • Firebase Cloud messagingApple SafariMozilla Services
          Connecting Web Push to a WebsiteTransferring Data to the PlatformWeb Push SDK Methods
            Import of subscriptions from third-party push servicesarrow
          • Migrating push subscriptions from third-party servicesHow to transfer push subscriptions configured for Safari?Migration from OneSignal
      SMS channel
        Creating mailing from scratcharrow
      • EmailSMSWeb PushMobile PushWhatsAppViber*™Руководство: SMS-рассылка через VK NotifyMAX BotMAX GroupNotifyTelegram BotTelegram Group
      Communication Channels WorkflowРуководство: SMS-рассылка через УТШРуководство: push-рассылка через сервис от "Согласие"
      Segmentationarrow
    • Static SegmentsDynamic SegmentsUpdatable Segments
        Segmentation Conditionsarrow
      • Segmentation by Profile dataSegmentation by Interactions with EntitiesSegmentation by Activity of the channelSegmentation by external dataSegmentation by external SQL tablesSegmentation 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 templateMAX templateTelegram templateWhatsApp templateViber™ templateNotify template
        Visual editor for email-templatearrow
      • Visual editor interfaceAdding blocksElements and their settingsCustom blocksStyle managerLayer 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
    • Mailings calendarBroadcast mailingsRegular mailingTrigger mailingMultivariate testingMailing testingMailing schedulePlacement mailing
      Campaignsarrow
    • Working with CampaignsLocal control groups (LCG)Audience expansionAudience building
      Automation scenariosarrow
    • Managing scenariosNodes of the scenarioClassic marketing scenariosStep-by-step welcome scenario guideScenario for automatic notification of the managerAbandoned cart scenario
      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 systemsБыстрый стартBasic 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
      Integrationsarrow
      • Action hooksarrow
      • Altcraft Action HooksAction hooks event typesAction Hook Message StructureJSON 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 app a trigger mailingEvent registrationGoogle Sheets and Altcraft integration AmoCRM and Altcraft integration
      Facebook Ads Manager™Google Ads AudiencesMAXYandex.Audience™VK Ads™Static segment synchronizationYandex AppMetrica™Tilda™Lpgenerator™WhatsAppViber*™ integrationIntegration scopeData Transmitted During SynchronizationNotify
      Weblayersarrow
      • Formsarrow
      • Create a formForm constructorAppearanceActions after form activationData analyticsBinding data channel and formsConditional logic in forms and surveysNPS 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 typesVariables typesLinking a pixel and the Tag manager
      Settingsarrow
    • Account settingsCustom linksVirtual sendersSending policiesAudit journalTags FAQ
        Users, groups and accessarrow
      • Two-Factor Authentication (2FA)
        Connectionsarrow
      • Connection to Facebook Ads ManagerConnection to Google AdsConnecting to Yandex.Audience™Connection to 360dialogConnection to EdnaConnection to Devino TelecomConnection to SMSTrafficConnection to VK Ads™Connection to MTS OmniChannelCustom Authentication ConnectionOAuth2 connectionBasic Authentication connectionToken Authentication connectionConnection to RapportoMAX connectionConnection to Notify
      Attribute settings
      API requests: where to startarrow
    • Import or update a profileTrigger mailing launchEngage profile in scenario
      Changelogarrow
    • v2026.1.76v2025.4.75v2025.4.74v2025.3.73v2025.2.72v2025.1.71v2024.4.70v2024.3.69v2024.2.68.2v2024.1.68
    Documentation archivelibrary
  • Integrations
  • Static segment synchronization

Static segment synchronization

Description​

Data from static segments can be synchronized with external SQL data tables. This integration is utilized when you need to maintain up-to-date information about customer groups in external systems. Data updates in the external system occur based on specific events.

  • Adding profiles to a static segment.
  • Removing profiles from a static segment.
  • Clearing (removing all profiles from) a static segment.
  • Creating or updating a static segment.
  • Deleting a static segment.

To add synchronization, select Integrations in the left menu. Then click on SQL.

Now click on + Create on the top of the page.

tip

To synchronize within the Altcraft Administrative Panel, you need to create a connector to an external SQL storage. You can find instructions on adding a connector here.

Integration settings​

In the main integration settings, enter the Integration name and Integration description. You'll also find a toggle switch here that allows you to activate or pause the integration.

Now set the integration scope. Below in the same section, select the SQL connector for the storage with the table where the data will be exported to.

SQL queries for event synchronization​

Below, you need to configure SQL queries that will add or remove data from an external table based on events related to the selected static segments.

tip

Queries can involve additional profile data and logical expressions. The matching of profile fields and data table columns is determined by the WHERE operator.

Adding and removing profiles, segment clearing​

caution

Queries for adding and removing profiles are mandatory for integration.

Events of adding or removing customer profiles from a static segment can be exported individually or in batches. When using batches, the number of added profiles (Batch Size) and a timeout (Timeout) are set. After the timeout, synchronization will be triggered even if the required number of profiles hasn't accumulated. Default timeout value — 60 seconds.

Example of data table structure
info

segId — static segment identifier

clientId — unique client identifier in the company's data center

updated — time of profile addition or removal


mysegment

+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| segId | int(11) | YES | | NULL | |
| clientId | varchar(255) | YES | | NULL | |
| updated | datetime | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+

Example of a batch profile addition query
info

{segment_id} — segment identifier in the platform

{$lead.CustomID} — custom (additional) profile field.

The batch is configured using the following cycle:

{for $index, $lead = $batch}
({segment_id}, "{$lead.CustomID}", NOW()){autocomma} // Here fields for export are specified
{end}

Altcraft variables and functions

INSERT INTO mysegment (segId, clientId, updated)
VALUES
{for $index, $lead = $batch}
({segment_id}, "{$lead.CustomID}", NOW()){autocomma}
{end}
ON DUPLICATE KEY UPDATE
updated = NOW();
Example of a batch profile removal query
info

{segment_id} — segment identifier in the platform

{$lead.CustomID} — custom (additional) profile field.

Altcraft variables and functions.

DELETE FROM mysegment
WHERE segment_id = {segment_id}
AND clientId IN ({batch_in "CustomID"})
Example of a query to remove all profiles from a segment
info

{segment_id} — segment identifier in the platform

Altcraft variables and functions.

DELETE FROM mysegment
WHERE segment_id = {segment_id}

Segment Addition/Update and Deletion​

Additionally, you can configure the export of events for adding a new segment, updating existing data, and segment deletion. Segment data is exported to a separate SQL table:

Example of data table structure
info

name — name of the static segment

segment_id — unique ID of the segment in Altcraft

updated — event date


segments

+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| name | varchar(255) | YES | | NULL | |
| segment_id | int(11) | YES | | NULL | |
| updated | datetime | YES | | NULL | |
+-------------+--------------+------+-----+---------+-------+

Example of a query for adding/updating a segment
INSERT INTO segments (segment_id,name,updated)
VALUES
({segment_id}, "{segment_name}", NOW())
ON DUPLICATE KEY UPDATE
name = "{segment_name}",
updated = NOW();
Example of a query for deleting a segment
info

{segment_id} — segment identifier in the platform

Altcraft variables and functions.

DELETE FROM segments
WHERE segment_id = {segment_id}
LIMIT 1
info

When transferring profile data to an external database using variables, single quotes ' will be escaped. The escape symbols used depend on the type of database:

DatabaseEscape symbolExample
MySQL, MSSQL, PostgreSQL, Oracle'(single quote)value''s
ClickHouse\ (backslash)value\'s

Synchronization Statistics​

In the Sync statistics section, information about the number of successful SQL queries within the specified time will be displayed, along with synchronization execution errors.

Using the Start resync button, you can recalculate segment data for export.

Last updated on Mar 12, 2026
Previous
VK Ads™
Next
Yandex AppMetrica™
  • Description
  • Integration settings
  • SQL queries for event synchronization
  • Adding and removing profiles, segment clearing
  • Segment Addition/Update and Deletion
  • Synchronization Statistics
© 2015 - 2026 Altcraft, LLC. All rights reserved.