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
  • Sending Files

Sending Files

When a channel template (Template) has a field of type file or image_upload, the file data is passed to the pipeline in base64 format. To send files, the $$ prefix of the templating language is used, which unpacks an array of files into a repeating structure.

File data structure​

Each file in the array contains the following fields:

FieldDescription
contentFile data in base64
nameFile name
mimeMIME type of the file (for example, image/png, application/pdf)
sizeFile size in bytes

Syntax in Pack​

To unpack an array of files in the Pack pipe, the following construct is used:

$$template.<shortname>[<array_name>]

Where:

  • <shortname> — shortname of the file field in Template (for example, file_field)
  • <array_name> — key name in the resulting JSON (for example, array, files, attachments)

Example: single file​

If Template has a single file field file_field, the Pack pipe will look like this:

{
"id": 1,
"type": "pack",
"params": {
"type": "JSON",
"template": {
"message": "$template.message",
"subid": "$subscription.subid",
"$$template.file_field[files]": {
"content": "[$]content",
"filename": "[$]name",
"type": "[$]mime",
"size": "[$]size"
},
"campaignId": "$in.c_id"
}
},
"outs": {
"success": 2,
"error": 3
}
}

Result in $in.body (with one file):

{
"message": "Hello",
"subid": "sub_123",
"files": [
{
"content": "base64encodeddata...",
"filename": "document.pdf",
"type": "application/pdf",
"size": "45000"
}
],
"campaignId": "101"
}

Example: multiple files​

If the user uploaded multiple files, each will be added to the files array:

{
"message": "Hello",
"subid": "sub_123",
"files": [
{
"content": "base64data1...",
"filename": "image1.png",
"type": "image/png",
"size": "12000"
},
{
"content": "base64data2...",
"filename": "image2.png",
"type": "image/png",
"size": "8000"
}
],
"campaignId": "101"
}

Full pipeline example with a file​

[
{
"id": 1,
"type": "pack",
"params": {
"type": "JSON",
"template": {
"message": "$template.message",
"subid": "$subscription.subid",
"$$template.file_field[files]": {
"content": "[$]content",
"filename": "[$]name"
},
"campaignId": "$in.c_id"
}
},
"outs": {
"success": 2,
"error": 3
}
},
{
"id": 2,
"type": "http_request",
"params": {
"method": "POST",
"timeout": 30,
"content_type": "json",
"url": "https://api.example.com/send",
"success_codes": [200]
},
"outs": {
"success": 4,
"error": 3
}
},
{
"id": 4,
"type": "event",
"params": {
"channel_id": 10001,
"action_type": 100001,
"event": {
"send_message_id": "$origin.send_message_id"
}
}
},
{
"id": 3,
"type": "event",
"params": {
"channel_id": 10001,
"action_type": 100003,
"event": {
"send_message_id": "$origin.send_message_id",
"message": "$error.code $error.message"
}
}
}
]
tip

Note the HTTP request timeout: when sending files, it is recommended to increase timeout (for example, to 30 seconds), since base64 data increases the request body size.

caution

A channel is not designed to send attachments larger than 1 MB per communication. It is recommended not to exceed 500 KB. For more details, see technical limitations.

Last updated on Jun 9, 2026
Previous
Templating Language
Next
Presets (Field Sets)
  • File data structure
  • Syntax in Pack
  • Example: single file
  • Example: multiple files
  • Full pipeline example with a file
© 2015 - 2026 Altcraft, LLC. All rights reserved.