messages_preview
Essential pre-flight. Body: {segment_sqid, steps: [...], num_leads}. Picks num_leads random leads from the segment, renders each sequence step against them (variable substitution + spintax + AI snippet generation where {{prompts}} appear), and returns the final subject/body text each recipient would see.
Use this before campaigns_activate to catch template bugs: unresolved ${vars}, empty AI snippets, weird spintax. The response includes per-lead errors arrays listing any template issues — fix those in the sequence, then re-preview. Each lead also carries compliance: {allowed, reason_codes} — what the compliance gates would decide for it (a preview never blocks).
Cost. Renders are free; AI snippets cost COMPOSE_EMAIL connects per successful generation (pay-per-success — failed generations don't charge). num_leads × number of {{prompt}} snippets is the upper bound. Balance pre-check returns 402 if insufficient.
Method: POST /api/v1/workspaces/{workspace_sqid}/messages/preview/
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"segment_sqid": "<segment_sqid>",
"steps": "<steps>"
},
"name": "messages_preview"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| steps | Yes | ||
| num_leads | No | ||
| is_threaded | No | Preview the steps as a threaded conversation, matching a sequence with `is_threaded` enabled: every step after the first gets a 'Re:' subject and quotes the preceding step. | |
| segment_sqid | Yes |