Use JSON Data in Email Templates
Fetch external JSON and render it with Bento's Liquid helpers to personalize outbound email on the fly.
Last updated: October 30, 2025
You can call public JSON endpoints from any Bento message and inject the response directly into your template. The fetch_json Liquid filter fetches the URL at send time, parses the payload, and exposes the result to the rest of your markup.
Heads up: Keep calls lightweight (small payloads, fast APIs) and make sure the endpoint can tolerate burst traffic from your campaigns.
Fetch a simple JSON object
Start with a placeholder API so you can see the pattern. Assign the remote resource to a variable, then render whichever fields you need.
{% assign post = "https://jsonplaceholder.typicode.com/todos/1" | fetch_json %}
<b>{{ post.title }}</b>
Swap the URL for any other JSON feed and the template will render the fresh data at send time.
Loop through API results
Many APIs return arrays. After fetching the payload, loop through the collection and print the properties that matter. The example below surfaces a random Bible verse from a public JSON feed.
{% assign verses = "https://labs.bible.org/api/?passage=random&type=json" | fetch_json %}
{% for verse in verses %}
<b>{{ verse.bookname }} {{ verse.chapter }}:{{ verse.verse }}</b>
<i>{{ verse.text }}</i>
{% endfor %}
This pattern works for testimonials, product inventory, news headlines—anything your subscribers will appreciate seeing refreshed automatically.
Wrap up
Pulling JSON keeps evergreen automations feeling live without manual edits. Document the endpoints you call, monitor for failures, and lean on Bento support if you need help hardening a workflow. Questions? Hop into the Bento Discord and we can review your template together.
Need the original Markdown? Open raw file