Automation recipes
Five ready-made workflows you can create in one call and adjust: a welcome series, re-engagement, birthdays, abandoned carts and post-purchase follow-ups.
Start from a recipe#
A recipe is a complete workflow graph: a trigger, the emails, the waits and the branches between them. Creating one gives you a draft workflow in your team; nothing is sent until you activate it.
Create the workflow
const recipes = await poststack.workflows.listRecipes(); const workflow = await poststack.workflows.createFromRecipe({ recipe: 'welcome_series', name: 'Welcome', }); // Pick a published template for each email step (dashboard editor, or the graph), // then check the graph and turn it on. const check = await poststack.workflows.validateGraph(workflow.publicId); await poststack.workflows.activate(workflow.publicId);curl https://api.poststack.dev/workflows/recipes \ -H "Authorization: Bearer $POSTSTACK_API_KEY" curl -X POST https://api.poststack.dev/workflows/from-recipe \ -H "Authorization: Bearer $POSTSTACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{"recipe": "welcome_series", "name": "Welcome"}' curl -X POST https://api.poststack.dev/workflows/wf_.../activate \ -H "Authorization: Bearer $POSTSTACK_API_KEY"poststack workflows recipes poststack workflows from-recipe welcome_series --name WelcomeChoose the emails
Each email step needs a published template. Open the workflow in the dashboard and pick one per step, or send the edited graph with
PUT /workflows/:id/graph.Activate
Activation checks the graph (every email step has a template, every branch leads somewhere) and that the emails meet the compliance rules for marketing mail.
GET /workflows/:id/statsandGET /workflows/:id/runsshow who entered, where they are, and who finished or exited.
The recipes#
| recipe | Trigger | What it does |
|---|---|---|
welcome_series | A contact is created | A welcome email, a getting-started email two days later, and a follow-up four days after that. Each contact goes through it once. |
re_engagement | A contact enters a segment | A check-in email. If it is not clicked within seven days, a last-chance email. A contact can enter again after 90 days. |
birthday | A date property | An email at 09:00 in the contact’s own time zone on the date in their birthday property, every year. |
abandoned_cart | Your app posts checkout.started | Waits up to four hours for order.placed. If no order comes, a reminder, then a second one a day later. An order ends the run at any point. |
post_purchase | Your app posts order.placed | A thank-you, a review request a week later, and a next-purchase suggestion three weeks after that. |
Welcome series
Runs for every new contact, however they arrived: the API, an import, or a signup form. Unsubscribed contacts are skipped at each email step. To welcome only one list, change the trigger to segment.entered or topic.subscribed.
Re-engagement
Point the trigger at a segment of inactive contacts, for example a rule on emailsOpened over the last 90 days. The second email is on the no_match branch of a wait_for_event step that waits for a click on the first, so anyone who clicks gets nothing more. To stop mailing people who never come back, combine it with the sunset policy.
Birthday
Store each contact's birthday as YYYY-MM-DD in a birthday property, or point the trigger at the property you already have. The year is ignored; the send time uses the contact's time zone.
Abandoned cart and post-purchase
Both start from events your app posts. The contact is found by email or contact_id, and data is available to the templates, so a reminder can link back to the cart.
// When a checkout starts…
await poststack.workflows.postEvent({
event: 'checkout.started',
email: 'ada@lovelace.io',
data: { cart_url: 'https://shop.example/cart/8121', total: '49.00' },
});
// …and when the order is placed, which ends the cart reminders.
await poststack.workflows.postEvent({
event: 'order.placed',
email: 'ada@lovelace.io',
data: { order_id: '8121' },
});curl -X POST https://api.poststack.dev/workflows/events \
-H "Authorization: Bearer $POSTSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"event": "checkout.started", "email": "ada@lovelace.io",
"data": {"cart_url": "https://shop.example/cart/8121", "total": "49.00"}}'Rules every workflow follows#
- Unsubscribed and suppressed contacts are skipped at each email step, and every workflow email carries one-click unsubscribe headers.
- A brand's workflow only enrols that brand's contacts and sends from that brand's domains.
- Quiet hours hold an email until a time window in the contact's time zone. See Quiet hours and time zones.
- Pausing holds every run at its next step; activating again continues each run from where it stopped, without repeating a step.