Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guideDeveloper guideAdmin guide
Company siteHelp center
English
  • Русский
  • English
v72
  • v74
  • v73
  • v72
Login
  • Getting Started
  • Administrator documentation
  • Functional characteristics
  • Technology description
  • System requirements
  • Admin Panel
  • Platform installation
  • Platform configuration
  • Platform maintenance
  • Custom channels guide
    • Overview
    • Creating and configuring a channel
    • Entity field configuration
    • Template language
    • Entities
    • Pipes
    • Pipelines
  • Extra
  • Processing HTTP/HTTPS traffic
  • Administrator API
This is documentation for Altcraft Platform v72. This documentation is no longer maintained.
The information for up-to-date platform version at this page is available (v74).
  • Custom channels guide
  • Template language
Documentation for version v72

Template language

Description​

Templates are used to access event fields. For example, when generating json, you need to add a identifier of a campaign, 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 campaign for each profile.
$in.launch_idstringUnique submission identifier. One for each campaign launch.
$in.a_idintAccount ID
$in.c_idintCampaign 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 campaign for the channel.
$subscriptionObjectData configured in the subscription for the channel.
$accountObjectData configured in the account for the channel.
$camp_scheduleОбьектCampaign start and stop settings.
$camp_schedule.start_timetimeScheduled campaign start time.
$camp_schedule.stop_timetimeScheduled campaign 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 - 2025 Altcraft, LLC. All rights reserved.