How to Add Countdown Timers to SendGrid Dynamic Templates

For developers and teams sending through the SendGrid Mail Send API: how to put a per-recipient countdown in a Dynamic Template using your own template data.

Give every transactional email its own deadline, straight from the data your app already sends to SendGrid.

Trial reminders, cart holds, booking confirmations and quote expiry emails usually go out through SendGrid's Mail Send API with a Dynamic Template. A Sendtric countdown timer fits these emails well, because the deadline is already in your system and the timer only needs you to hand it over. If you send newsletters as Single Sends instead, the Marketing Campaigns guide is the one you want.

Sendtric's Dynamic Code tab showing a timer preview and embed code with a send-time value in the ?to= parameter
The Dynamic Code tab. In SendGrid you replace the timestamp tag with your own template variable.

SendGrid itself doesn't render countdowns. What it does give you is Handlebars: any key you put in dynamic_template_data can be printed in the template with {{key}}, including inside an image URL. That is all a Sendtric timer needs.

FeatureSendtric + SendGrid Dynamic TemplatesNative SendGrid
Countdown timer in transactional emailYesNo
Deadline per recipient from your template dataYesNo
Countdown that starts at send timeYesNo
Start-on-Open timer keyed to your user IDYesNo
Change the design after sendingYesNo

Which countdown timers does SendGrid support and what are they used for

Fixed date timers

Use these when every recipient shares the same deadline, for example an order cutoff for holiday delivery printed in every shipping confirmation. Paste the code as it is; no template data is involved.

Start-on-Open timers

The clock starts when the recipient opens the email, which suits "your discount is reserved for 30 minutes" messages. With Unique User Timer on, Sendtric needs something that identifies the recipient. Pass your own user ID, for example {{user_id}}, rather than relying on SendGrid, which has no built-in recipient ID. Start-on-Open needs the Micro plan or higher.

Start-on-Send and Dynamic timers

This is where Dynamic Templates shine. SendGrid has no send-time tag, but your app knows when it is calling the API, so it can include that moment as a Unix timestamp. A Start on Email Send timer adds your chosen duration to it. A Dynamic Timer counts down to any date you pass, such as a trial end date or a reservation expiry. Both need the Power plan or higher.

How to add a countdown timer to a SendGrid Dynamic Template

Step 1: Create the timer

In Sendtric, open Timers, click Create New and choose Start on Email Send or Dynamic Timer. Set the duration if there is one, style the timer and click Save.

Sendtric's Create New Timer window with the four timer type cards, including Start on Email Send and Dynamic Timer

Step 2: Swap the placeholder for your template variable

With SendGrid selected as the Email Service Provider, Sendtric can't fill in a send-time tag, so the code contains a {UNIX TIMESTAMP} placeholder and the editor shows a warning. Copy the code and replace the placeholder with your own Handlebars variable. A Start on Email Send timer for 24 hours ends up looking like this:

<img src="https://gen.sendtric.com/countdown/abc123xyz?to={{send_time}}+86400" style="display: block;max-width:100%;" />

For a Dynamic Timer, ?to= takes the deadline itself, either a Unix timestamp or an ISO 8601 date such as 2026-12-01T17:00:00+00:00.

Step 3: Add the code to your template version

In SendGrid, go to Email API > Dynamic Templates, open your template and edit the active version, or click Add Version. In the Design Editor, open the Build tab and drag a Code module into place. If your version uses the Code Editor, paste the snippet straight into the HTML.

SendGrid's Design Editor Build tab with the Add Modules grid and the Code module highlighted

Step 4: Paste, update and save

Paste the code into Edit Module HTML, click Update, then Save the version. If you created a new version, set it live with Make Active.

The Edit Module HTML panel in SendGrid with a Sendtric timer image tag pasted in and the Update button

Step 5: Send the variable from your app

Add the key to personalizations.dynamic_template_data in your Mail Send request. The key name must match the variable in the template exactly.

"personalizations": [{
  "to": [{ "email": "jamie@example.com" }],
  "dynamic_template_data": {
    "first_name": "Jamie",
    "send_time": 1796121600
  }
}]

Step 6: Test with a real API call

Use Preview with Show Test Data to check the layout, then send one real request to yourself. Open the email and check the countdown, then view the image address and confirm {{send_time}} was replaced by a number. If to is missing, a dynamic timer shows a two-minute countdown; if it can't be read, no image shows.

Unix seconds or milliseconds both work

Sendtric accepts either, so you can pass whatever your language produces, for example Math.floor(Date.now() / 1000) in JavaScript or int(time.time()) in Python. An ISO date without a time zone offset is read as UTC.

Keep timer variables out of the subject line

The timer variable only belongs in the image URL. If you also use Handlebars in the subject, SendGrid needs a subject value in your test data for test sends to work.

SendGrid Dynamic Template Timer FAQ

Can I use a trial end date instead of the send time?

Yes. Choose Dynamic Timer in Sendtric and pass the trial end date as ?to={{trial_end}}. The timer counts down to that moment for each recipient. Our transactional timers article has more ideas.

Do I need double or triple braces around the variable?

Double braces are fine for numbers and ISO dates. SendGrid's Handlebars escapes HTML characters with double braces, which doesn't affect digits, letters, colons or dashes.

What happens if my app forgets to send the value?

Handlebars prints nothing, so Sendtric gets no usable deadline. Depending on what is left in the URL, the recipient sees either a short two-minute countdown or no timer at all. Add a check in your code so the value is always present before you call the API.

Can I reuse one Sendtric timer across many Dynamic Templates?

Yes. The design lives in Sendtric and the deadline comes from each request, so the same timer code can sit in any number of templates.

Which plan do I need for Start-on-Send and Dynamic timers?

Both need the Power plan or higher. Start-on-Open timers need Micro. See pricing for the full comparison, and which timer type to use if you are not sure.

This guide covers one piece of Sendtric's email personalization platform. For every countdown timers option and example, see the main page.

More SendGrid guides

Using a different platform? See all Sendtric integrations.

Martin Tenev

Martin is a Growth Manager who is enthusiastic about all things growth and AI including how to create email campaigns that convert.

Connect on LinkedIn

Ready to boost your email conversions?

Join thousands of marketers using Sendtric's Email Personalization Platform to drive conversions.