Custom programmable block

Jaroslav Bouška Jaroslav Bouška
5. September 2025

In this block you can prepare data for a template, or create your own logical conditions to control the flow of contacts within an automation. In addition to functions that can be used in templates or when preparing a campaign, the custom block has several features for managing data flow directly – delay settings, multiple output points, ending a contact’s flow, and more.

Available variables in the automation block.

global – contains an object with all data, including custom variables

contact – contains an object with data about the contact

stateData – contains an object with data about the contact’s state in the automation. The object’s format is variable and depends on how the contact entered the automation and how it was handled there. For example, it may contain information about an order or a shopping cart that led the contact into the automation, or an identifier of a sent transactional email or SMS. Data from the saveData function is also stored here.

Usage:

{{ global.company.name }} - outputs the company name from the defined custom variable company

{{ contact.email }} - recipient's email address - if the recipient exists in the mailing lists
{{ contact.surname}} - recipient's last name - if the recipient exists in the mailing lists

{{ stateData.orderId }} - returns the order ID that was used to add the recipient to the automation

Save data to contact automation

saveData dataName data

Description: saves data to the automation contact with the specified name.

Arguments: dataName – the variable name under which the data will be stored. Allowed characters are a-Z, hyphens and underscores.

Return value: true/false – returns true if the data was saved successfully.

Usage:

{{
myData = { "storeNumber" : 1 }
result = saveData 'myData' myData
}}

Saved data can be used in other parts of Boldem, e.g., when dispatching an email, where the data is available under the variable automationCustomData. If you want to display the store number from the example in the email template, use the following variable:

{{ automationCustomData.mojeData.cisloProdejny }}

To access data within the same automation, use stateData.customData instead (for example, to use the store number, use stateData.customData.mojeData.cisloProdejny).

Status update completed

setFinishedState

Description: marks the contact’s current status in the automation as completed. The automation will no longer continue for that contact

Arguments:

Return value: true/false – returns true if the data was saved successfully.

Usage:

{{ setFinishedState }}

Output point settings

setOutputPoint outputPointLetter

Description: sets the output point for the contact’s current state in the automation.

Arguments: outputPointLetter – letter identifying the output point – A, B, C, D, …

Return value: true/false – returns true if the data was saved successfully.

Usage:

{{ setOutputPoint 'A'}}

Schedule further processing for a specific time

setNextStart customDate

Description: for the contact being processed in an automation, allows setting a delay or the date and time for the next continuation.

Arguments: customDate – the date and time in UTC for the contact’s next continuation within the automation.

Return value: true/false – returns true if the data is successfully validated and saved.

Usage:

{{ setNextStart '2023-04-11 11:59' }}

Email dispatch

Send Email

1. Option – Dispatch email with template

Description: Function to dispatch an email using a custom block

Arguments: emailData – data model TransactionalEmailSendModel with the email definition for dispatch

Return value: TransactionalEmailSendResultModel

Usage: (You can copy and try this exactly as-is)

{{
   emailData = {
    "bodyHtml":"<!DOCTYPE html><html lang=\"en\"><head></head><body>This is a transactional email test</body></html>",
    "subject":"This is a subject test",
    "from":"email@vasedomena.cz",
    "to":{
      "address":contact.email
      },
      "variables": {
        "isRegistred : true
      }
   }
   sendEmail emailData
}}

Option 2 – Dispatch email with template ID

{{
  sendEmail {
    "templateId": 1,
    "to": {
      "address": contact.email
    },
    "variables": {
      "isRegistered": true
    }
  }
}}

Create a custom event

addCustomEvent schemaName data allowTriggering

Description: creates a custom event for the contact being processed in the automation.

Arguments:
schemaName – name of the custom event schema
data – data object
allowTriggering – whether the custom event can be included in automation

Return value: true/false – returns true if the data was saved successfully.

Usage:

{{ addCustomEvent 'page_view' { "url" : "https://boldem.cz" } true }}

Removal of custom events

removeCustomEvents schemaName

Description: removes the custom events of the specified schema for the contact being processed in the automation.

Arguments:
schemaName – name of the custom event schema

Return value: true/false – returns true if the data was saved successfully.

Usage:

{{ removeCustomEvents 'page_view' }}

Loading the last used promo code

loadLastUsedCoupon couponGroupId

Description: For the contact being processed in the automation, loads the last used promo code from the specified promo codes group.

Arguments:
couponGroupId – ID of the promo code group

Return value: returns CouponLastUsedModel

Usage:

{{ last coupon = loadLastUsedCoupon 5 }}
{{ coupon.coupon }}

Loading external JSON data from a URL

httpGet URL headers

Description: Downloads data from a URL for use in automation.

Arguments:
url – URL with external data in JSON format
headers – key-value pair to include in the request header, can be null

Return value: ScriptHttpResponse

Usage:

{{ response = httpGet 'https://www.boldem.cz/some.json' {'Authorization': 'Basic {{Base64EncodedLogin:Password}}'} }}
{{ saveData 'reponse' 'response.data' }}

Dispatch JSON data to a URL using POST

httpPost URL data headers

Description: Sends data to a URL via POST as part of an automation.

url – endpoint URL
data – request body
headers – key-value pairs to include in the request headers, may be null

Return value: ScriptHttpResponse

Usage:

{{ response = httpPost 'https://webhook.site/0ebdf147-8849-471a-926e-e54d240884c5' {"name": "value"} null

Edit contact details

Save contact: new partial data

Description: As part of automation, modifies the contact information – this applies only if the contact already exists in your database.

newPartialData – an object where you provide only the custom fields/values you want to update.

Usage:

{{ saveContact {"my_custom_column_name": "New value"} }}

Loading transactional email information

getTransactionalEmail transactionalEmailId/transactionalEmailGuid

Description: The function retrieves information about a sent transactional email, including its variables.

transactionalEmailId/transactionalEmailGuid – you can use the email ID or GUID to look it up

Return value: TransactionalEmailModel

Usage:

{{ tranEmail = getTransactionalEmail stateData.transactionalEmailId }}