Test and publish an automation

Validate, read readiness, dry-run for a contact, preview an enrollment, publish, and what a new version does to people mid-journey.

A draft saves even when it isn't finished. These checks tell you, and an agent, exactly what is left before it can go live.

1. Validate

Validate checks the graph and everything it uses. Send definition (and policy) to check a change before saving it. ok: true means publish would succeed now. Each issue has a code, the node_id, and the config path to fix.

cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/validate' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{}'
CodeBlocks publishFix
unknown_kindYesUse a block kind from the catalog (and pick a trigger).
invalid_configYesFix the config field named by path on that block (required, type or allowed value).
trigger_not_triggerYesThe trigger must be a trigger.* kind.
node_kind_is_triggerYesOnly the trigger can be a trigger.* kind; use an action or flow block.
duplicate_node_idYesGive every block a unique id.
duplicate_edge_idYesGive every edge a unique id.
edge_unknown_fromYesPoint the edge's from at an existing block id.
edge_unknown_toYesPoint the edge's to at an existing block id.
edge_unknown_handleYesUse one of the block's handles as fromHandle (or omit it on single-path blocks).
edge_duplicate_handleYesOne edge per handle: remove the extra edge.
edge_into_triggerYesNothing can lead into the trigger: remove that edge.
missing_handle_edgeYesWire every handle of the block (named by handle); end unused ones in a flow.exit.
orphan_nodeYesConnect the block from an earlier block, or delete it.
cycleYesRemove the loop: graphs run forward only. Use a wait for event to model repetition.
trigger_disconnectedYesAdd a first block after the trigger.
dependency_unavailableYesA template, topic, segment or sender is missing or not ready (a warning at validate, an error at publish). Pick an existing, published one.
path_unknown_scopeYesStart the data path with contact., handle., event., steps. or run.
path_unknown_stepYessteps.<id> must name a block that runs before this one.
path_scope_unavailableYesTrigger, wait-for-event and goal filters can't read steps.* or run.*; use contact.* or event.*. A {{steps.…}} value works only in a wait-for-event filter; {{event.…}} (the run's trigger) also in the goal's filter and the exit rule.
sms_quiet_hoursNoAdvice only: marketing texts wait for each recipient's quiet hours.
sms_variables_unmappedNoMap each {{variable}} in the text in variables, or the step can fail for some contacts.
email_variables_unmappedYesMap every template variable in variables (a path, { path, fallback } or { value }).
sms_trigger_creates_contactsNoAdvice only: any text from a new number becomes a contact. Use a keyword match to limit it.
sms_trigger_marketing_replyNoAdvice only: a text in isn't marketing consent; send a transactional reply or record consent first.
wait_until_pastYesPick a future date, or a weekday for a moment that repeats.
wait_until_contact_timezoneNoAdvice only: contacts without a timezone field use fallbackTimezone.
wait_too_longYesShorten the wait or timeout to the longest wait allowed.
path_outlives_runYesShorten the waits on that path, or raise the policy's maxRunDuration.
run_lifetime_too_longYesLower the policy's maxRunDuration to the cap.
path_over_action_limitYesShorten the path (fewer action blocks; waits, branches and exits don't count) or split the journey into two automations: every run on it would stop at the action limit.
webhook_secret_regenerateNoSend "secret": "generate" on that block (the new secret comes back once in the write's answer) and give it to whoever verifies the requests.
event_data_secretNoAdvice only: event data is kept in the event log and run history and goes to subscribed webhooks. Send tokens, codes and sign-in links from your own backend, not through the event.
condition_ref_missingYesA condition names a segment or topic that doesn't exist or is archived (path points at it). Use a live one's id from the segments or topics list, or remove the condition.
wait_until_not_a_dateYesPoint relativeTo.path at a DATE contact field (or change the field's type to Date): other values never read as dates, so every run would take the no-date rule.
wait_until_field_unknownNoAdvice only: no contact has that field yet, so runs take the no-date rule until it is set. Check the field key.
template_type_mismatchYesLeave transactional out of the email block: the template's type (set on the template) decides how it is sent.
marketing_template_fixed_recipientYesPick a transactional template for an email to a fixed address (an internal alert).
topic_needs_marketing_templateYesPick a marketing template, or remove the topic: transactional emails go to everyone.

2. Read readiness

Validate also returns readiness, the checklist in plain words. Each item has a severity (blocker, needs_input: it can go live but nothing happens until someone provides something, such as an event your backend hasn't sent yet or a number to send texts from, or heads_up) and an owner (user, developer, agent). journey is the whole automation as sentences with timings. Publish when readiness.ready is true.

3. Dry-run for a contact

Simulate walks the draft (or the live version) for a real or made-up contact and says which messages they'd get, when, and which branch they'd take. Nothing is sent.

cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/simulate' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "email": "sam@acme.com",
    "event_data": {
      "cart_url": "https://shop.acme.com/cart/123"
    }
  }'

4. Preview an enrollment (manual trigger)

For an automation you enroll people into by hand, the preview says whether a contact would start a run now. It checks, in order:

  1. automation_live: The automation must be live (not a draft, paused or archived).
  2. manual_trigger: Only a manual-enrollment trigger takes enrollments.
  3. contact_found: The contact must exist in this workspace.
  4. run_in_progress: The contact isn't already mid-journey.
  5. re_entry: The re-entry rule allows them in again.
  6. no_consent: Something in it can reach them: not every message would be skipped for them by consent (D-B).
  7. run_rate: They haven't hit the hourly run limit.
  8. max_active_runs: The automation is under its live-run ceiling.
  9. workspace_live_runs: The workspace is under its live-run ceiling.

5. Publish

Publishing snapshots the graph and policy as a version and starts enrolling on the trigger. It needs automations:publish. GET on the same path previews what it would do to people already mid-journey. For a segment or topic trigger, GET …/publish?backfill=true also counts the people already in it a backfill would start; publish with that count as backfill_count (only when the person asks) and a job starts them a few at a time (backfill.job, follow it with GET /v1/jobs/{id}).

cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/publish' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "changelog": "First version"
  }'
Statuserror.codeWhenFix
422validation_errorThe draft has validation errors. Each details[] entry has field (nodes.<id>.config.<path>), code and a message.Fix each by its code and field, validate again, then publish.
422validation_error (dependency_missing, dependency_unhealthy, dependency_wrong_type, condition_ref_missing)A template, topic, segment or sender the draft uses is missing, unpublished, on an unverified domain, or the wrong type. condition_ref_missing: a condition names a segment or topic that is gone (field is the condition's, policy.… for the exit rule or goal).Point the field named in details[].field at a ready resource.
422validation_errorThe stored policy doesn't parse (a value PATCH would refuse now).Send the whole policy again with PATCH, corrected.
404not_foundNo such automation in this workspace.Check the id (atm_…) with the list.
409conflict (removed_blocks_choice_required)People are on blocks this version removes and removed_blocks wasn't sent.Read the publish preview, ask the person, then publish with removed_blocks: "move_to_next" or "end".
422validation_errorbackfill_count was sent and the backfill can't run: the trigger isn't a segment or topic one, backfill is off, more would start than one backfill may, nobody is left to start, it would use up the period's automation runs (a plan without a balance) or the live-run room, or more would start now than the count confirmed. Nothing went live.Read GET …/publish?backfill=true first and confirm its backfill.count with the person; publish without it, or send a campaign to the people already there.
409conflict (backfill_in_progress)backfill_count was sent while a backfill of this automation is still running. This request changed nothing (an earlier publish may already be live).Follow the running job (the preview's backfill.job), or stop it, then publish again.
409conflict (automation_archived)The automation is archived: switched off, read-only, and deleted for good at its delete_after unless unarchived.Ask the person; unarchive it (it comes back switched off), then publish. Never copy it to get around the archive.
409conflictNothing to publish, a billing, block or review-throttle pause still holds, or a text step has no SMS number that can send (the message says why).Tell the person the reason in the message; a billing pause lifts on its own when the allowance returns.
403insufficient_scopeThe key lacks automations:publish, or a read capability the automation passes data from: an email-received trigger needs emails:read (a text-received one sms:read), and a Call webhook block needs contacts:read plus the trigger's own read capability (segments:read, topics:read, emails:read, …). The message names the one missing.Use a key or sign-in with the named capability.
403limit_reached (feature_not_in_plan)The automation sends SMS and the plan doesn't include it.Remove the SMS step or move to a plan with SMS.

New versions and people mid-journey

  • A paused automation holds its runs where they are, including the run whose step paused it; resume (or a publish) continues them.
  • While paused, a trigger that fires starts nothing, and it isn't replayed on resume. A run on a wait keeps counting; when its next step comes due during the pause, the pause holds it there (the run reads held: true).
  • A message held for more than 7 days by a pause is not sent on resume unless you pass send_stale: true.
  • Publishing a new version moves everyone mid-journey to it at the block they're on; a wait in progress keeps its end time.
cURL
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/publish' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "changelog": "Dropped the second reminder",
    "removed_blocks": "move_to_next"
  }'

Search docs and guides

Search the docs and product guides.