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
  • Pipelines
  • Pipes
  • Pack

Pack

Pack is a Pipe for packing data into JSON or XML. The result is written to $in.body as a byte array, ready to be passed to the HTTP Request pipe.

Parameters​

FieldTypeRequiredDefaultDescription
typestringNoJSONPacking format: JSON or XML
templateobjectYes—Structure of the resulting JSON or XML. Values support templating
caution

XML is described in JSON format using the notation of the clbanning/mxj library:

  • Element attributes are written with a - prefix (e.g., "-type": "MESSAGE")
  • Text content is written as "#text"
  • JSON arrays are converted into repeating XML elements

Possible Errors​

  • Invalid value of params.type
  • Error processing params.template — incorrect template or field not found

Examples​

JSON​

Pipe:

{
"id": 6,
"type": "pack",
"params": {
"type": "JSON",
"template": {
"acceptUrl": "$template.acceptUrl",
"backgroundColor": "$template.background_color",
"backgroundImage": "$template.background_Image",
"campaignEnd": "$camp_schedule.stop_time",
"feeType": "fix",
"campaignFee": 0,
"campaignStart": "$camp_schedule.start_time",
"campaignType": "$campaign.campaignType",
"categoryId": "$#campaign.category.category",
"conditions": "$template.conditions",
"description": "$template.description",
"discountAmount": "$#template.discountAmount",
"discountCurrency": "$#template.discountCurrency",
"discountType": "$template.discountType",
"fontColor": "$template.font_color",
"merchantDomain": "$account.merchantDomain",
"merchantLogoPng": "$account.merchantLogoPng",
"merchantLogoSvg": "$account.merchantLogoSvg",
"merchantName": "$account.merchantName",
"offerEnd": "$camp_schedule.stop_time",
"partnerCampaignId": "$#origin.c_id",
"blockIds": "$#campaign.blockIds",
"$$campaign.segment[segments]": ["[$]id"],
"test_obj": {
"field1": 1,
"field2": ""
}
}
},
"outs": {
"success": 7,
"error": 8
}
}

Result in $in.body:

{
"acceptUrl": "http://example.com/accept_url",
"backgroundColor": "#ffffff",
"backgroundImage": "http://example.com/background_image",
"campaignEnd": "2021-08-09T18:31:42",
"feeType": "fix",
"campaignFee": 0,
"campaignStart": "2021-05-09T15:22:00",
"campaignType": "test",
"categoryId": 50,
"conditions": "test_condition",
"description": "",
"discountAmount": 155,
"discountCurrency": 482,
"discountType": "RUB",
"fontColor": "#ffffff",
"merchantDomain": "http://example.com/merchantDomain",
"merchantLogoPng": "http://example.com/merchantLogoPng",
"merchantLogoSvg": "http://example.com/merchantLogoSvg",
"merchantName": "merchantName",
"offerEnd": "2021-08-09T18:31:42",
"partnerCampaignId": 101,
"blockIds": ["adfadf", "dadasdasdas", "aaaaaa"],
"segments": ["aaaa", "bbbb"],
"test_obj": {
"field1": 1,
"field2": ""
}
}

XML​

Pipe:

{
"id": 106,
"type": "pack",
"params": {
"type": "XML",
"template": {
"event": {
"-cancel": "false",
"-type": "MESSAGE",
"-xmlns": "http://example.com/event.xsd",
"recipients": {
"recipient": {
"addresses": {
"address": [
{
"-channel": "APL",
"-type": "CLIENT_ID",
"-value": "$subscription.id"
}
]
}
}
},
"templates": {
"template": [
{
"#text": "$template.title",
"-channel": "APL",
"-type": "TITLE"
},
{
"#text": "$template.body",
"-channel": "APL",
"-type": "BODY"
},
{
"#text": "$template.push_body",
"-channel": "PUSH",
"-type": "BODY"
}
]
}
}
}
},
"outs": {
"success": 108,
"error": 109
}
}

Result in $in.body:

<?xml version="1.0" encoding="UTF-8"?>
<event xmlns="http://example.com/event.xsd" cancel="false" type="MESSAGE">
<recipients>
<recipient>
<addresses>
<address channel="APL" type="CLIENT_ID" value="aaaaaaaa" />
</addresses>
</recipient>
</recipients>
<templates>
<template channel="APL" type="TITLE">some title</template>
<template channel="APL" type="BODY">some body</template>
<template channel="PUSH" type="BODY">some push body</template>
</templates>
</event>
Last updated on Jul 21, 2026
Previous
HTTP Request
Next
Unpack
  • Parameters
  • Possible Errors
  • Examples
    • JSON
    • XML
© 2015 - 2026 Altcraft, LLC. All rights reserved.