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 SendsayENS: настройка сендера
        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 account dataProxy server settingsKeycloak Integration with AltcraftGetting HTTP service statusesConfiguration MongoDB logs rotation
        Configuration of system constants and directoriesarrow
      • Filtering bot actionsDirectory of gender markers
      Platform maintenancearrow
    • Personnel requirementsPlatform maintenance processesPlatform updatingPlatform service monitoringBackup and recoveryTransferring the platform to a new serverCreating, deleting, and populating tables for statistics in ClickHouseUsage of the aktool utilityUsers and directories engaged by the platform
      Custom channels guidearrow
    • OverviewCreating and configuring a channelEntity field configurationTemplate languageEntities
        Pipesarrow
      • Pipe: Basic ConceptsResultErrorsLogPackUnpackHTTP RequestStore SetStore GetSelectorSQLEventerScheduler
        Pipelinesarrow
      • Pipeline: Basic ConceptsMessageScheduleListenerModerateStop
      Extraarrow
    • System page customizationSend Message IDИнструкция по миграции истории в ClickHouseInstructions for migrating history to ClickHouseUtility for importing push subscriptions to Firebase projectUtility for importing push subscriptions to Firebase project
    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 accountDelete 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 guide
  • Template language

Template language

Description​

Templates are used to access event fields. For example, when generating json, you need to add a identifier of a mailing, sender or message body to it.

Keywords​

Keywords begin with one of the following prefixes:

ParameterMeaning
$Inserts a value as a string.
$#Allows you to use the original field type.
$$Allows you to unpack an array into several repeating structures.

It should only be used with a template field of the "file" type, since you often need to add several files to a message.

For the $ and $# prefixes, there are two options for writing the pattern:

$template.field

And

${template.field}
caution

The $$ prefix only supports a template's notation without curly braces.

A pattern prefixed with $ can be freely combined with strings, i.e. a pipe field containing such a template may also contain constant text.

For example:

qwerty$in.a_id

or

qwerty${in.a_id}ytsuken
caution

Patterns prefixed with $# and $$ cannot be combined with strings.

Keywords:

ParameterTypeDescription
$inObjectData that came into the pipe from the previous one, if any.
$in.send_message_idstringSend Message ID. The unique identifier of the message generated by the mailing for each profile.
$in.launch_idstringUnique submission identifier. One for each mailing launch.
$in.a_idintAccount ID
$in.c_idintMailing ID.
$originObjectData received in the pipeline.
$templateObjectData configured in the message for the channel.
$senderObjectData configured in the sender for the channel.
$resourceObjectThe data configured in the resource for the channel.
$campaignObjectData configured in the mailing for the channel.
$subscriptionObjectData configured in the subscription for the channel.
$accountObjectData configured in the account for the channel.
$camp_scheduleОбьектMailing start and stop settings.
$camp_schedule.start_timetimeScheduled mailing start time.
$camp_schedule.stop_timetimeScheduled mailing stop time.
$errorObjectSigns of a previous pipe error
$error.codeintError code, for example HTTP code.
$error.messagestringText content of the error.

Accessing object fields​

All keywords that have an Object type can have nested fields, which can also be objects or arrays of objects. Therefore, the following syntax is introduced:

  • An object field is accessed via '.' (dot). There are no restrictions on the amount of nesting.
$template.field_name.inner_field_name
  • An array element is accessed via '.%<element index>'. There are no restrictions on the amount of nesting.
$template.field_attach.%0.name

Functions​

FunctionDescriptionExample of usageResult
$base64Returns base64 from the value.$base64('Hello')SGVsbG8=
$gen_uniq_int_idReturns a unique 10-digit number.$gen_uniq_int_id()1726573911
$escapeCharactersRemoves the symbols.$escapeCharacters('Hello 'world')Hello world
$getWebhookURLProvides a webhook.$getWebhookURL($origin.send_message_id)https://altcraft.com/fbp/v1/1/1?fffffffffff
$removeCodeFromPhoneRemoves the area code from the phone number.$removeCodeFromPhone('89505062312')9505062312
$#toObjectTurns JSON from a string into an object.$#toObject('{"a": "b"}'){"a": "b"}

Examples​

  1. General example
At the entrance:

{
"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"
}
}

At the exit:
{
"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"
}
]
}

  1. Let’s assume that the params.url field in the HTTP Request pipe is configured as follows:
https://example.com/handler/v${sender.version}/test

then after processing the template the params.url field will be rendered as:

https://example.com/handler/v2/test
  1. Let’s assume that in the Pack the params.template.test_field field is configured as follows:
qwerty$in.a_id

then after processing the template the params.url field will be rendered as:

qwerty5

but the following option will return an error because you can't concatenate a string and an int:

qwerty$#in.a_id
Last updated on Nov 9, 2023
Previous
Entity field configuration
Next
Entities
  • Description
    • Keywords
    • Accessing object fields
    • Functions
  • Examples
© 2015 - 2026 Altcraft, LLC. All rights reserved.