Two discriminated actions — synchronously resolve %variables% across the outbox, or queue an AI generation task for a single node.
action field in the body:
resolve — synchronously resolves %variables% for every non-AI sendable node across every prospect and upserts campaign_prospect_messages rows as draft. Also copies pre-generated AI examples onto matching prospects (matched by lead name). Manually-edited rows are preserved; template changes flow through to unedited rows.generate_ai — queues the generate-ai-messages Trigger.dev task for a specific AI node. Charges AI_MESSAGE_GENERATION credits per prospect after the task is queued. The pre-flight credit check returns 402 without destroying any existing messages.draft status.
resolve is safe to re-run. It upserts on (campaign_id, prospect_id, node_id) and excludes manually-edited rows from the upsert — template changes propagate without clobbering user customizations. If the “find edited messages” query itself fails, the server falls back to ignoreDuplicates: true for the whole batch to avoid silently overwriting edits.AI seeding matches on lead name. When resolve seeds AI drafts from generated_examples, it normalizes first_name + last_name and matches against prospects. Duplicate names yield multiple rows (one per prospect); unmatched examples are logged and skipped. After adding new prospects or regenerating the skeleton, re-run resolve to pick up the new matches.generate_ai credit flow. Credits are previewed before any write — a 402 response means no existing messages were deleted and no task was queued. Credits are only charged AFTER the task is successfully enqueued. For single-prospect regeneration (prospect_ids provided), the server deletes the existing draft for that (node, prospect) pair first so the task can produce a fresh version.Related endpoints. For reading the draft outbox or inline-editing a single message, see GET and PATCH on the same path. For building the framework before calling resolve, see generateCampaignContent.Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Campaign UUID
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Discriminated by action. resolve synchronously re-aggregates draft messages; generate_ai fires a background task and returns immediately.
Resolve %variables% for every non-AI sendable node across every prospect, seeding campaign_prospect_messages rows as draft. Also copies pre-generated AI examples onto matching prospects (by lead name). Safe to re-run — manually-edited drafts are preserved; unedited rows are overwritten so template changes flow through.
resolve Action completed. Shape depends on action — inspect the example that matches your call.
Every message row touched by the resolve. Empty array when the campaign has no sendable nodes, no prospects, or no template changes propagated.