Campaigns

Preview a campaign email

Renders draft email content using the selected contact's fields and declared templateData fallbacks.

POST
/v1/campaigns/preview

Renders draft email content using the selected contact's fields and declared templateData fallbacks. Creates no campaign run or message. Omit contactId to preview the fallback data alone.

Authorization

apiKey
headerx-api-key<token>

Request Body

application/json
  1. body
content*||
audience*
contactId?|null

Response Body

CampaignPreview

application/json
  1. response
subject*string
preheader?string
html*string
Lengthlength <= 2097152
text*string
Lengthlength <= 2097152
Example Request
import { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.campaigns.preview({  "content": {    "channel": "email",    "email": {}  },  "audience": {    "topicId": "example"  }});
Example Response
{  "subject": "string",  "preheader": "string",  "html": "string",  "text": "string"}

Related documentation