Recipe
A named sequence of nudges bundled as a single addressable program (e.g. "week-one welcome series", "30 days of gratitude") with the audience attached. Recipe is the only audience mechanism in the schema — there's no separate audience table — but it's not the only way a nudge gets sent: direct API calls against a trigger_type=webhook schedule pass the user_id explicitly and skip the recipe. Use recipes for group sends (cohort/theme/course/specific user); use the API path for event-actor or ad-hoc one-off sends. Content and firing rules come from NUDGE / NUDGE_SCHEDULE / NUDGE_CRON in nudge.
See also: user, cohort, theme, course — any of these can be a recipe's target.
Tables
RECIPE
A named sequence of nudges targeted at exactly one of: a USER, a COHORT, a THEME, or a COURSE. The audience is a polymorphic pointer — target_type (user, cohort, theme, course) picks the audience table and target_id the row inside it — which mirrors the USER_ACTION pattern and removes the ambiguity of four nullable FK columns ("is this for user X and cohort Y, or one inside the other?"). Resolving an audience at send time means walking from the target to the affected users (e.g. target_type=cohort → all active enrollments in that cohort).
id rcp_01_gratitude_30d
target_type theme
target_id thm_01_gratitude
title 30 days of gratitude nudges
description Daily nudge series running alongside the gratitude course.
RECIPE_STEP
One step in a recipe, in position order. Each step references a NUDGE_SCHEDULE, so the recipe inherits both the nudge content and its firing rules from an existing schedule row rather than redefining them.
id step_01_day1
recipe_id rcp_01_gratitude_30d
nudge_schedule_id sch_01_three_things_daily
position 1