The Dinner inKind Missed: Building a First-Reward Journey

In October I installed inKind, the restaurant rewards app, through a referral, which put a $25 reward in my account toward a first meal of $50 or more. I browsed restaurants around San Diego and saved a couple.
Then life happened. Over the next couple of weeks I got two general brand emails. Neither mentioned my $25 or the restaurants I'd saved, and no push came, even with notifications on. One Saturday night my wife and I were deciding what to order for dinner, and we ended up scrolling Google Maps. inKind never crossed my mind, with $25 sitting in the app.
That's not a complaint about inKind. It's a common gap in lifecycle marketing: someone shows intent, and nothing follows up while the intent is still warm. A push around 4:30 on a Friday, saying "your $25 is waiting at the place you saved," would very likely have won that dinner.
So I built that message, end to end, as a public repo: the data contract, the journey, the Liquid email and push, a Snowflake proof of concept, a Braze trial, and a small Rails backend. This post walks through each piece, what it does, and what I learned building it. Everything uses made-up users and fictional restaurants, and the repo isn't affiliated with inKind. The schema names are my guesses.
The journey: one save, two chances
The whole idea fits in one Canvas. Saving a restaurant is the signal that someone is thinking about going out, so that's the entry. The send waits for 4:30 PM in the user's own time zone, when dinner plans get made. If the reward still hasn't been used three days later, there's one more try on Friday at 4:30, and then the journey ends either way.

A purchase ends the journey at any point, not just at the decision. A second, smaller Canvas covers new users who open the app three times in their first two weeks but never save anything. They get the same timing with nearby picks instead of a saved restaurant, and the moment they save one, they exit and the main Canvas takes over.
The data: what Braze needs to know, and where it comes from
A message is only as good as the profile behind it. The repo starts with a data contract: every field the journey reads, its type, and how it reaches Braze. There are two paths, split by how fresh the data has to be.
- Real time, through the API: events that start or end the journey. When someone saves a restaurant or pays, the backend sends it to Braze's
/users/trackendpoint. The purchase goes this way so the journey's exit fires immediately, not on the next sync. - The warehouse, through Cloud Data Ingestion: values computed in Snowflake, like the unused reward amount. Braze syncs only the rows that changed since the last sync.
The Snowflake side is a runnable proof of concept: ten synthetic users, each built to cover a case the journey has to handle, and a view shaped the way Cloud Data Ingestion reads it. Two details in that view do most of the work.
CREATE OR REPLACE VIEW braze_first_reward_attributes AS
SELECT
r.user_id AS EXTERNAL_ID,
GREATEST(r.updated_at, COALESCE(t.first_at, r.updated_at)) AS UPDATED_AT,
OBJECT_CONSTRUCT_KEEP_NULL( -- keeps nulls so a used reward clears in Braze
'first_reward_amount', IFF(r.redeemed_at IS NULL, r.amount, NULL),
'first_reward_display', IFF(r.redeemed_at IS NULL,
IFF(r.amount = FLOOR(r.amount),
TO_VARCHAR(r.amount::INT),
TRIM(TO_VARCHAR(r.amount, '9999990.00'))),
NULL),
'first_reward_min_spend', IFF(r.redeemed_at IS NULL, r.min_spend::INT, NULL),
'first_transaction_at', t.first_at -- NULL = never paid
) AS PAYLOAD
FROM rewards r
LEFT JOIN (
SELECT user_id, MIN(created_at) AS first_at
FROM transactions
GROUP BY user_id
) t ON t.user_id = r.user_id
WHERE r.reward_type = 'referral_welcome';A used reward is sent as null. When the reward is redeemed, the amount comes through as JSON null, and a null tells Braze to remove the attribute. That's why the view uses OBJECT_CONSTRUCT_KEEP_NULL. A plain OBJECT_CONSTRUCT drops the key instead, and the old "$25 waiting" value would stay on the profile of someone who already spent it.
The display amount is formatted once, in the warehouse. Whole dollars show as "25" and amounts with cents as "12.50", stored as text. The message template never formats money.
The last of the 11 checks shows a bug on purpose. One synthetic user paid on October 14, but the record didn't land in the warehouse until the 27th. If the sync's UPDATED_AT comes from when the purchase happened, a sync that already ran skips the late row, and Braze never learns the user paid. They keep getting "your reward is waiting." It doesn't take thirteen days: a record an hour late, across a sync, is skipped the same way. The fix is to stamp UPDATED_AT with the time the row arrived in the warehouse.
All 11 checks pass in a clean Snowflake account, and walkthrough 1 runs them on camera.
The message: Liquid that stops itself
The email and push are written in Liquid, Braze's templating language, and split into Content Blocks so the pieces can be reused across messages without anyone rewriting Liquid:
- Design tokens (
ik_brand): the colors, type sizes and spacing every visible block reads, so changing one block restyles every message. - Logic blocks that never print anything.
ik_get_rewardreads the reward and decides whether it can be promoted.ik_get_saved_restaurantlooks the saved restaurant up in a Braze Catalog. - Visible blocks: the hero, the restaurant cards, the "how to use it" section with the minimum spend, and the footer.
The part I care about most is what happens when the data is wrong. Before any lookup runs, the message checks the reward. If there's no unused reward, if the amount is zero, or if the minimum spend is missing, the message calls abort_message with its own reason and nothing goes out. That last case matters: without a minimum, the copy would promise "$25 off any meal." The abort sits in the message itself, not inside a Content Block, so the stop is visible to anyone reading the message.
{{content_blocks.${ik_brand}}}{{content_blocks.${ik_urls}}}{{content_blocks.${ik_get_reward}}}
{%- unless reward_ok -%}
{%- case reward_skip_reason -%}
{%- when 'zero_amount' -%}{%- abort_message("reward amount is zero") -%}
{%- when 'no_minimum' -%}{%- abort_message("reward minimum missing") -%}
{%- else -%}{%- abort_message("no unused reward") -%}
{%- endcase -%}
{%- endunless -%}
{{content_blocks.${ik_get_saved_restaurant}}}
{%- unless saved -%}{{content_blocks.${ik_get_nearby}}}{%- endunless -%}The nearby-restaurants lookup is optional, so it's built to fail quietly. If the call fails or returns nothing, the email falls back to a "Find a spot near you" button instead of breaking.
The Liquid has 184 tests that run in CI. They render every block and message against fixture users: a saved restaurant, a saved ID missing from the Catalog, nothing saved, the recommendations call down, a $12.50 reward, long restaurant names that have to fit a push. One parity test makes sure the email and the push always make the same offer, because it's easy for a person or an agent to update one and forget the other. Another fails if any email loads an image from outside the repo.
The Braze trial: what worked, and what the trial taught me
Tests against fixtures only prove the Liquid works in my renderer. I wanted to see it render in Braze, so I loaded it into a Braze trial workspace by hand.
The setup went in this order, and the order matters:
- The Catalog.
restaurants_catalog, imported from CSV: ID, name, cuisine, price, rating, cash-back percentage, address, description, location ID, photo and thumbnail. Every column came in as String, which is what the templates expect. - The users. Imported before any Content Block, because Braze won't save a block that references a custom attribute it hasn't seen yet. CSV import guessed
first_reward_displaywas a Number. That would have turned "$12.50" into 12.5, so I set it to String before importing. - The Content Blocks. The trial caps a workspace at eight, and the repo has seventeen. So the eight that carry the most logic went in as real blocks, and a small build script inlines the rest into one trial email body. The production version keeps them separate.
- The campaign. One email, previewed as each test user.
The previews matched the tests. The $25 user got the full email. The $12.50 user saw $12.50, not $12.5. The user with zero reward, the user with no minimum spend, and the user with no reward at all each stopped the send, each with its own abort reason in the preview.
The trial also pushed back in a few places, and each one was useful:
- Arrays don't import by CSV. The mapping screen marks an Array column "Destination type unsupported," so
saved_restaurantscouldn't come in that way. To show the saved-restaurant card, I pinned one test user's lookup to a Catalog ID. The card rendered with the restaurant's name, image and link from the Catalog. In production, that array would arrive through Cloud Data Ingestion or the API. - Connected Content is blocked. The trial won't launch a block that uses it, even inside a Liquid comment. So the nearby-restaurants block went in as a stub, and the email falls back to the saved card or a generic "explore near you" link, which is the same fallback the tests cover.
- The preference center has to exist. The footer's unsubscribe tag names a preference center. Until one with that exact name exists, the preview fails. That's a good failure: it means a typo there can't reach a user.
- One limit I caught before loading anything.
:retryon a Connected Content call aborts the message after five failures. It's in Braze's docs. The nesting limit gets its own story below.
None of this is production Braze. It's a trial, loaded by hand, so the point was to find out where the design and the platform disagreed before anything real depended on it.
The backend: where a purchase clears the reward
The journey's exit depends on one fact: did the user spend the reward? That has to reach Braze fast. If it doesn't, someone who used their $25 on Thursday gets a Friday push telling them it's still waiting.
The repo has a small Rails app that plays the part of inKind's backend. It's not meant to look like inKind's real system. It's there to show the event path end to end.
When a fictional user pays with their reward:
- The payment and the reward are saved together. The transaction is recorded and the reward is marked used in one database transaction. If either fails, neither is saved.
- A background job is queued after the commit, so Braze only ever hears about payments that actually happened. Solid Queue runs it, and Mission Control at
/admin/jobsshows it. - The job writes one delivery row with a unique key,
purchase:<transaction_key>, and builds the payload once. Retries resend that stored payload instead of rebuilding it. If two runs race, the unique index stops a second row. - The event goes to Braze as a purchase, through the
/users/trackendpoint. That's what triggers the Canvas exit.
# Looks first. If a concurrent run creates the row between the look-up and the insert,
# the unique index raises RecordNotUnique and we reuse the row the other run made.
def find_or_create_delivery(kind, record)
key = idempotency_key(kind, record)
BrazeDelivery.find_by(idempotency_key: key) || create_delivery(kind, record, key)
end
def idempotency_key(kind, record)
identifier = kind == "purchase" ? record.transaction_key : record.id
"#{kind}:#{identifier}"
endThe trial has no REST API, so the app runs in record mode: the job builds the exact request it would send and stores it on the outbox row instead. You can open any row and read the payload. A Re-send button queues the same job again. It finds the existing row by its key, so it never creates a second one, and a row that's already recorded isn't sent again.
The Rails app has 146 tests.
The second path is the warehouse. Every 10 minutes, a background job exports new and changed rows and MERGEs them into a RAILS_DEMO schema in Snowflake, which the same CDI view reads. The CDI preview page at /warehouse/cdi_preview shows what Braze would receive for each user, including the nulls that clear a spent reward.

So there are two ways the fact reaches Braze: in real time through the event, and every few minutes through the warehouse. If the event never arrives, the next sync still clears the reward, and the message's own check stops the send because there's no unused reward left to promote.
How it was built: agents draft, tests decide
The first version took about a week, from October 26 to November 2: 11 merged pull requests and about 70 commits. Most of the code was drafted by AI coding agents running in my own setup, ctrl+shft. That's only a fair thing to say because of what sits around the agents.
The flow for each piece of work was the same:
- A ticket with the goal, the files in scope, and what "done" means.
- The test first. Before an agent touched the code, the ticket said which test had to fail now and pass after.
- The agent drafts on a branch and opens a pull request.
- CI decides. The 184 Liquid tests and the 146 Rails tests run on every pull request. If one fails, the PR doesn't merge, no matter how good the diff looks. The 11 SQL checks need a Snowflake account, so I run those by hand in a worksheet.
- I review what the tests can't judge: wording, whether the logic matches the journey, whether it's the right change at all.
The clearest example is the nesting limit. Braze's docs say Content Blocks nest only one level deep, and the repo had a block nested two levels. In PR #4, the first commit added the tests, including one that walks every block's includes and fails above one level. Seven failed. The fixes came after, and the tests stay, so neither a person nor an agent can bring the problem back.
MAX_LEVELS = 2
INCLUDE = re.compile(r"\{\{content_blocks\.\$\{(\w+)\}\}\}")
def chains(source, blocks=BLOCKS, prefix=()):
"""Every chain of block names reachable from source, outermost first."""
for name in INCLUDE.findall(source):
if name in prefix:
raise AssertionError(f"Content Block cycle: {' -> '.join(prefix + (name,))}")
chain = prefix + (name,)
yield chain
yield from chains(blocks[name], blocks, chain)
@pytest.mark.parametrize("path", MESSAGES, ids=lambda p: p.name)
def test_no_block_chain_goes_deeper_than_two(path):
too_deep = [c for c in chains(path.read_text(encoding="utf-8")) if len(c) > MAX_LEVELS]
assert not too_deep, "Braze would drop: " + "; ".join(describe(c) for c in too_deep)

At the end I ran a separate agent as an auditor, with no context from the build, and asked it to find real problems. I checked every finding by hand against the code. Some were wrong: it flagged a JWT that "never refreshes" when it does, and it called the late-arrival bug in check 11 critical when that bug is there on purpose, to show the check catching it. Five findings were real, and those five were fixed.
The same pattern works for campaign QA: let agents do the volume, and make the checks strict enough that a wrong change can't get through.
One change, start to finish: removing a saved restaurant
After the first version shipped, I ran a simple check against the design: everything a user can create, they should also be able to change or remove. Saved restaurants failed it. A user could save a place and never drop it, and the Braze profile had the same problem: saved_restaurants could only grow, so a message could keep naming a restaurant the user had given up on.
The fix went in one slice at a time, each starting with a failing test: the model writes a restaurant_unsaved event, the payload carries the remaining list, the delivery can be resent, and the console gets a Remove button. Nine new Rails tests and four new Liquid cases, which is where the 146 and 184 come from.
The tests and a walk through the flow found two problems the design hadn't covered:
- A queued job crashed after its record was removed. If someone removed a save before its
restaurant_savedjob ran, the job couldn't find the record and raised. Now the job notices the record is gone and sends nothing. The removal's own event carries the current list, so nothing is lost. - A removed restaurant could still be named. A Canvas carries the restaurant from the save that started it, and it can sit in its 4:30 delay for hours. A failing test reproduced it, and now the message only uses that restaurant while the profile still lists it. The same rule went into the Content Block and the single-file message, so the parity test still holds.
One gap is still open, and it's on Braze's side: a Canvas doesn't exit when a restaurant is removed. That's a Canvas setting the repo can't configure, so it's written down in docs/gaps.md rather than papered over. The whole change, including the two places I broke a test file along the way, is in docs/change-log.md.
What I'd do next
If this were going into a real workspace, these are the next pieces:
- A send log. Braze message events (sends, opens, clicks, aborts) streamed back into Snowflake, so every abort reason from the Liquid is countable, and orders can be checked against what was actually sent.
- Frequency caps by tag. One rule across every reward-reminder message, so this journey can't stack on top of another campaign in the same week.
- Live API sends. The Rails outbox already builds the request. With a real API key, record mode turns off and the purchase reaches Braze within seconds.
- A measured result. The 10% control group is already in both Canvases. The number that matters is first-reward use within 14 days against that control, then whether people come back for a second visit.
- An agent loop for experiments. Agents that propose a variant, run the full test suite against it, and only then put it in front of a person to approve. The same rule as the build: agents draft, checks decide.
Links
- The repo: github.com/arndvs/inkind-first-reward-journey
- The three walkthroughs are embedded above, and in the README's Walkthroughs section.
The fine print
Every restaurant, user and number in the repo is made up. I'm not affiliated with inKind, and this isn't their code or their data. The Snowflake schema names are my guesses at a reasonable shape, not inKind's. Everything Braze-side here ran in a trial workspace, loaded by hand.