Skip to content
Home » Bloomreach Wait Node with Jinja

Bloomreach Wait Node with Jinja

    Bloomreach Wait Node with Jinja

    Dynamic wait nodes in Bloomreach Marketing evaluate Jinja expressions by calculating the numerical difference between a target Unix timestamp and the current execution timestamp. Configuring wait units in seconds or applying the ceil rounding filter to hours ensures precise scenario execution.

    When calculated duration is zero or negative, the profile skips the wait step and proceeds immediately.

    How mature is your CRM setup?

    Find out in minutes with a free CRM maturity check.

    Get Your Free Check

    Bloomreach Wait node Jinja wait until specific time

    A dynamic Wait node holds scenario execution by evaluating a Jinja expression that calculates time in seconds or hours. The expression subtracts the current execution timestamp from a target future timestamp, returning the wait duration. Bloomreach Marketing provides the time variable, which represents the current Unix timestamp in seconds at the moment the profile enters the Wait node.

    The calculation depends on having both a target timestamp and the current time available. Target timestamps can come from event attributes, profile attributes, or fixed values you define. The Wait node then pauses the customer journey for the calculated duration before advancing to the next step.

    When the expression evaluates to a positive number, the profile waits. If the result is zero or negative, the profile skips the wait entirely. This behavior is essential for scenarios where target times might already have passed.

    Calculating wait duration in seconds versus hours

    Wait duration in seconds is the simplest calculation: subtract the current timestamp from the target timestamp. The formula is {{ target_timestamp - time }}. This produces a whole number representing seconds.

    Converting to hours requires dividing by 3600 (the number of seconds in an hour). The formula becomes {{ (target_timestamp - time) / 3600 }}. However, Bloomreach Marketing truncates fractional hours downward by default.

    Setting dynamic wait units to hours without applying ceil rounding causes the platform to truncate fractional hours down, resulting in messages dispatching up to 59 minutes earlier than intended.

    To ensure full wait durations, apply the Jinja ceil rounding filter: {{ ((target_timestamp - time) / 3600) | round(method="ceil") }}. This rounds any fractional hour upward to the next whole hour, preventing premature dispatch. The choice between seconds and hours depends on your precision requirements and the time scales involved in your scenario.

    How to set up a Wait node for a specific date and time

    1. Construct a target Unix timestamp for your specific date and time

      Then subtract the current execution timestamp. First, identify the target date and time in your scenario. For example, to wait until 14:00 on 15 December, convert that calendar date to a Unix timestamp using an external converter or calculate it within the expression.

    2. If you have the target timestamp stored

      If you have the target timestamp stored in a profile or event attribute, reference it directly: {{ event.scheduled_time - time }}. If you need to calculate it from component values, use Jinja date functions to build the timestamp. Bloomreach Marketing supports date arithmetic, allowing you to construct timestamps from year, month, day, hour, and minute values.

    3. Enter the expression into the Wait node’s custom wait time field

      Set the time unit to seconds if using the raw formula, or hours if you have divided by 3600 and applied ceil rounding. Test the expression with a test profile to verify the calculated duration is positive and reasonable before activating the scenario.

    Calculating wait times before scheduled customer events

    Subtract an offset period from the event timestamp to create a wait that ends at a specific time before the event. For an appointment reminder 24 hours before the scheduled time, use {{ event.appointment_time - 86400 - time }}. The value 86400 represents 24 hours in seconds.

    For 48 hours before, use {{ event.appointment_time - 172800 - time }}. For two hours before, use {{ event.appointment_time - 7200 - time }}. The pattern is: target event timestamp minus the offset period in seconds, minus the current time.

    If the offset is given in hours, convert it to seconds by multiplying by 3600. For example, to wait until 6 hours before departure, use {{ event.departure_time - (6 * 3600) - time }}. This approach works for any event attribute containing a future Unix timestamp, such as flight times, reservation dates, or delivery windows.

    Managing time zone offsets and GMT BST in Jinja

    Convert all timestamps to UTC (Coordinated Universal Time) before performing calculations. Bloomreach Marketing stores and processes timestamps in UTC internally, so your target timestamp and the time variable are both in UTC.

    If your target time is in a local timezone like UK time, calculate the UTC equivalent by adding or subtracting the timezone offset. During GMT (winter), UK time is UTC plus zero hours. During BST (summer), UK time is UTC plus one hour. For a 14:00 BST target, calculate the UTC equivalent as 13:00 UTC, then convert that to a Unix timestamp.

    The challenge is that Daylight Saving Time transitions occur on specific dates. If your scenario runs year-round, you must either store pre-calculated UTC timestamps in profile or event attributes, or use Jinja logic to detect the transition date and apply the correct offset. Most implementations store event times directly in UTC to avoid this complexity.

    What happens when dynamic wait duration is negative or zero

    If the calculated wait duration is zero or negative, Bloomreach Marketing skips the wait step immediately and advances the profile to the next scenario action. This occurs when the target timestamp is in the past or equals the current execution time.

    Negative values typically arise when the target time has already passed before the profile reaches the Wait node. This is common in scenarios where event times are unpredictable or where profiles enter the scenario after the intended wait period. The platform’s immediate advancement prevents profiles from stalling indefinitely.

    Zero values occur when the target time exactly matches the execution timestamp, which is rare in practice. Both conditions trigger the same behavior: the profile does not pause and continues the journey without delay. Design your scenario to handle this gracefully, either by routing the profile to a fallback step or by ensuring target times are always in the future when profiles enter the Wait node.

    Bloomreach Wait node versus On Date trigger

    A Wait node pauses an individual profile mid-journey based on dynamic calculations, while an On Date trigger controls when profiles initially enter a scenario based on a fixed schedule. Use a Wait node for customer-specific timing, such as pausing until an appointment time or a calculated deadline. Use an On Date trigger to start a scenario at a fixed time for all profiles, regardless of individual attributes.

    Wait nodes evaluate Jinja expressions at runtime, adapting to each profile’s data. On Date triggers execute once at a scheduled time and process all eligible profiles in batch. If you need different profiles to wait different lengths of time, use a Wait node. If all profiles should enter the scenario at the same clock time, use an On Date trigger.

    In practice, many scenarios combine both. An On Date trigger might start a campaign at 09:00 daily, and then a Wait node within the scenario pauses each customer until their individual event time arrives. Voxwise has observed that this hybrid approach prevents scenario congestion and ensures personalised timing without overloading the execution engine. Evaluate your scenario’s entry conditions and journey logic to determine which mechanism fits your use case.

    Configuration MethodJinja FormulaOutput UnitRecommended Use Case
    Exact Timestamp Offset{{ target_timestamp - time }}SecondsEvent-driven scenarios with precise timing requirements
    Hours Ceil Rounding{{ ((target_timestamp - time) / 3600) \| round(method="ceil") }}HoursAppointment reminders and multi-hour waits
    Relative Pre-Event Offset{{ event.time - (offset_hours * 3600) - time }}SecondsNotification before scheduled customer events
    Zero/Past Fallback{{ [0, target_timestamp - time] \| max }}SecondsPrevent negative waits and ensure immediate advancement

    FAQ

    How does Bloomreach Marketing handle decimal fractions when dynamic wait duration is in hours?

    Bloomreach Marketing truncates fractional hours downward by default, so a calculated duration of 2.8 hours becomes 2 hours. To round up instead, apply the Jinja ceil filter: {{ ((target_timestamp - time) / 3600) | round(method="ceil") }}.

    Can a dynamic Wait node evaluate custom profile attributes alongside event timestamps?

    Yes, you can reference any profile or event attribute in the Jinja expression. For example, {{ event.appointment_time - profile.reminder_offset - time }} subtracts a custom offset stored in the profile from the event time before calculating the wait duration.

    What variable returns the current execution timestamp in Bloomreach Marketing Jinja?

    The time variable returns the current Unix timestamp in seconds at the moment the profile executes the Wait node expression. This is always in UTC.

    Does updating a dynamic Wait node Jinja expression affect customers currently waiting?

    Bloomreach Marketing evaluates the expression when the profile enters the Wait node, not continuously during the wait. Updating the expression does not retroactively change wait durations for profiles already paused in that node.

    Review your Wait node timing

    Audit your dynamic Wait node Jinja expressions in Bloomreach Marketing to ensure target timestamps are calculated correctly and wait units match your scenario requirements. Voxwise can help you evaluate scenario timing architecture and optimise Wait node configurations for precision and performance.

    Tags: