Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guide iconUser guide
Developer guide iconDeveloper guide
Admin guide iconAdmin guide
English
  • Русский
  • English
Login
    Getting StartedAdministrator documentationFunctional characteristics
      Technology descriptionarrow
    • Architecture OverviewComponent Description
        Deployment schemesarrow
      • Basic schemeFail-safe schemeTypical Placement in Infrastructure
    System requirements
      Admin Panelarrow
      • Account areaarrow
        • Accountsarrow
        • Account UsersAccount Virtual SendersAccount Database Indexes
        TariffsExternal data configurationLDAPTasksSchedule JobsGlobal Stop ListsWebversion Store Policies
        Settingsarrow
      • Databases
          Accessarrow
        • AdminsAPI tokens
        Notifiers
          MTAarrow
        • Default rulesRetry rulesLock rulesBounce patternsStrategiesKeysISPsPools
      Nodes
        Sendersarrow
      • EmailSMSEvent generatorIntegration with Altcraft Cloud SMTPIntegration with Sendsay
        Reportsarrow
      • Audit JournalData Usage
        Toolsarrow
      • ARF decoderURL decoderSMID decoderLicense
      Platform installationarrow
    • Automatic installationManual installationRunning the platform in a Docker container
      Platform configurationarrow
    • Configuration fileDomain settingsLDAP access configurationSending Email via SMTP relayPixel and push domain configurationCluster and Replication SetupSystem notifications configurationProcesses UNIX sockets configurationHTTPS ConfigurationMigrating from MongoDB Community Edition to Percona Server for MongoDBAdding sender IP addressesDeduplication request settingsPostgreSQL database for Market dataProxy server settingsKeycloak Integration with AltcraftGetting HTTP service statusesConfiguring MongoDB log rotation
        Configuration of system constants and directoriesarrow
      • Filtering bot actionsDirectory of gender markers
      Custom Channelsarrow
    • Creating a Channel
        Pipelinesarrow
      • MessageScheduleListenerModerateStop
          Pipesarrow
        • HTTP RequestPackUnpackEventerSchedulerSelectorSQLStore SetStore GetLogResultError
      External Objects (Entities)Templating LanguageSending FilesPresets (Field Sets)DebuggingTechnical Limitations
      Platform maintenancearrow
    • Personnel requirementsPlatform maintenance processesPlatform updatingBackup and recoveryTransferring the platform to a new serverCreating, deleting, and populating tables for statistics in ClickHouseUsing the aktool utilityUsers and directories engaged by the platformPlatform service monitoringProcess and mailing monitoring via Prometheus
      Extraarrow
    • System page customizationSend Message IDClickHouse History Migration GuideInstructions for migrating history to ClickHouseUtility for importing push subscriptions to Firebase projectUtility for importing push subscriptions to Firebase projectENS: настройка интеграции
    Processing HTTP/HTTPS traffic
      Administrator APIarrow
      • Accounts admin apiarrow
        • Restricted accessarrow
        • Account Activation and DeactivationAccount Freeze and Unfreeze
        Get accounts listAdd a new accountDelete the account
        Account usersarrow
      • Update an Existing AccountAdd a new userDelete a userGet a list of usersSending a Welcome Email
        Nodesarrow
      • Synchronize node MTA configurationGet nodes listGet node MTA statusActivate node MTADeactivate node MTA
        Senders admin apiarrow
      • Create or update AKMTA senderGet AKMTA sender informationAssign account to senderGet senders listDelete senderRestore sender
          Sender queuearrow
        • Get sender queue informationHold sender queueRelease sender queueClear sender queue
        Virtual sendersarrow
      • Get virtual senders listGet virtual sender informationCreate virtual senderUpdate virtual senderClone virtual senderDelete virtual sender
    Documentation Archive
  • Custom Channels
  • Templating Language

Templating Language

The templating language is used in pipelines and external objects to access channel data. It allows you to insert values of template fields, mailing, sender, subscription, and other entities into pipe parameters — for example, when forming a JSON request to an external API.

Prefixes​

Each template starts with one of three prefixes that determine how the value is processed:

PrefixBehaviorCan be combined with text
$Inserts the value as a stringYes
$#Inserts the value preserving the original type (int, bool, array, etc.)No
$$Unpacks an array into a repeating structure. Used for fields of type "file"No

Notation format​

For the $ and $# prefixes, two notation variants are available:

$template.field
${template.field}

The curly brace variant is convenient when you need to clearly separate the template from surrounding text:

qwerty${in.a_id}qwerty

For the $$ prefix, only the notation without curly braces is allowed.

Concatenation with text​

A template with the $ prefix can be freely combined with constant text:

https://example.com/handler/v${sender.version}/test

Templates with the $# and $$ prefixes cannot be concatenated with strings — they return the value strictly of their own type. For example, the notation qwerty$#in.a_id will cause an error if a_id has type int, because a string and a number cannot be concatenated.

Keywords​

Keywords are the names of objects available in the pipeline context. Access to object fields is done through a dot (.), with no limit on nesting depth.

Pipeline data​

KeywordTypeDescription
$inObjectData passed to the current pipe from the previous pipe (if any)
$in.send_message_idstringFull message identifier (SMID), generated by the mailing for each profile
$in.unique_message_idstringUnique message identifier (SMID with version)
$in.launch_idstringUnique sending identifier. One per mailing launch
$in.a_idintAccount identifier
$in.c_idintMailing identifier
$originObjectOriginal data that came into the pipeline
caution

In the Schedule pipeline, $origin is replaced with the value of params.template of the Scheduler pipe. The original pipeline data is not available — pass everything needed through the template of the Scheduler pipe.

Channel entities​

KeywordTypeDescription
$templateObjectData filled in the message for the channel. Fields are accessed by shortname: $template.<field_shortname>. If presets are used, only fields of the selected preset are available. Current preset: $template._presets_ids
$senderObjectData filled in the sender for the channel
$resourceObjectData filled in the resource for the channel
$campaignObjectData filled in the mailing for the channel
$subscriptionObjectData filled in the subscription for the channel
$accountObjectData filled in the account for the channel

Mailing schedule​

KeywordTypeDescription
$camp_scheduleObjectMailing start and stop settings
$camp_schedule.start_timetimeMailing start time in the schedule
$camp_schedule.stop_timetimeMailing stop time in the schedule

Errors​

KeywordTypeDescription
$errorObjectError data from the previous pipe
$error.codeintError code (for example, HTTP code)
$error.messagestringText description of the error

Accessing fields and arrays​

Object fields​

Access to an object field is done through a dot (.):

$template.field_name.inner_field_name

Array elements​

Access to an array element is done through .%<index> (zero-based indexing):

$template.field_attach.%0.name

Functions​

The following built-in functions are available in templates:

General functions​

FunctionDescriptionExampleResult
$base64Encodes a value in base64$base64('Hello') or $base64($sender.login:$sender.password)SGVsbG8=
$gen_uniq_int_idGenerates a unique 10-digit number$gen_uniq_int_id()1726573911
$escapeCharactersRemoves special characters from a string$escapeCharacters('Hello \'world\'')Hello world
$getWebhookURLForms a webhook URL for a callback$getWebhookURL($origin.send_message_id)https://altcraft.com/fbp/v1/1/1?fffffffffff
$removeCodeFromPhoneRemoves the region code from a phone number$removeCodeFromPhone('89505062312')9505062312
$#toObjectConverts a JSON string to an object$#toObject('{"a": "b"}'){"a": "b"}

Getting entity names by message_id​

These functions allow you to get human-readable entity names by message identifier. Useful for logging, report generation, and conditional branching in pipelines. If the entity is not found, the function returns an error.

FunctionDescriptionExamplemessage_idunique_message_id
$getCampaignNameCampaign name$getCampaignName($in.unique_message_id)YesYes
$getTemplateNameTemplate name$getTemplateName($in.send_message_id)Yes—
$getDatabaseNameDatabase name$getDatabaseName($in.unique_message_id)YesYes
$getSegmentNameSegment name. If segment is not set — No segment$getSegmentName($in.send_message_id)Yes—
$getWorkflowNameScenario name. If scenario is not set — No workflow$getWorkflowName($in.send_message_id)Yes—
$getResourceNameResource name. If resource is not set — No resource$getResourceName($in.unique_message_id)YesYes

Getting entity IDs by message_id​

FunctionDescriptionExamplemessage_idunique_message_id
$getCampaignIDCampaign identifier (string)$getCampaignID($in.unique_message_id)YesYes
$getTemplateIDTemplate identifier (string)$getTemplateID($in.send_message_id)Yes—
$getDatabaseIDDatabase identifier (string)$getDatabaseID($in.unique_message_id)YesYes
$getSegmentIDSegment identifier (string)$getSegmentID($in.send_message_id)Yes—
$getWorkflowIDScenario identifier (string)$getWorkflowID($in.send_message_id)Yes—
$getResourceIDResource identifier (string)$getResourceID($in.unique_message_id)YesYes

Getting attribute value​

The function $getAttributeValue returns the value of a custom attribute (custom field) by its identifier. Attributes are set at the mailing, workflow, or campaign level and are inherited hierarchically: the mailing value has the highest priority, then the workflow, then the campaign.

FunctionDescriptionExample
$getAttributeValueReturns the attribute value (string). First argument — message_id, second — attribute identifier (string)$getAttributeValue($in.send_message_id, "attribute_1")

If the attribute is not found at any level of the hierarchy, the function returns an empty string.

Examples​

All prefixes​

Input data of the pipe:

{
"attribute as string": "$sender.id",
"attribute as original type": "$#sender.id",
"attribute as part of string": "test $sender.name",
"$$template.field_files_template[array]": {
"content": "[$]content",
"filename": "[$]name",
"type": "[$]mime",
"size": "[$]size",
"constant": 1,
"sender_id": "$sender.id"
}
}

Result after template processing:

{
"attribute as string": "145",
"attribute as original type": 145,
"attribute as part of string": "test interstellar sender",
"array": [
{
"content": "base64string",
"filename": "file1.txt",
"type": "text/plain; charset=utf-8",
"size": "10",
"constant": 1,
"sender_id": "145"
},
{
"content": "base64string",
"filename": "file2.txt",
"type": "text/plain; charset=utf-8",
"size": "100",
"constant": 1,
"sender_id": "145"
}
]
}

Template in URL​

The params.url parameter of the HTTP Request pipe:

https://example.com/handler/v${sender.version}/test

After processing (when sender.version = 2):

https://example.com/handler/v2/test

Concatenation and types​

The params.template.test_field parameter of the Pack pipe:

qwerty$in.a_id

Result (when in.a_id = 5):

qwerty5

The same notation with the $# prefix will cause an error, because a string and a number cannot be "concatenated":

qwerty$#in.a_id  // error
Last updated on Jul 21, 2026
Previous
External Objects (Entities)
Next
Sending Files
  • Prefixes
    • Notation format
    • Concatenation with text
  • Keywords
    • Pipeline data
    • Channel entities
    • Mailing schedule
    • Errors
  • Accessing fields and arrays
    • Object fields
    • Array elements
  • Functions
    • General functions
    • Getting entity names by message_id
    • Getting entity IDs by message_id
    • Getting attribute value
  • Examples
    • All prefixes
    • Template in URL
    • Concatenation and types
© 2015 - 2026 Altcraft, LLC. All rights reserved.