Schedule a campaign run
Schedules an email campaign run at the absolute ISO-8601 instant in scheduledFor, or immediately when omitted.
Schedules an email campaign run at the absolute ISO-8601 instant in scheduledFor, or immediately when omitted. The optional Idempotency-Key header is scoped to the organization and replays return the original run. An email campaign must carry the brand footer: it is refused with CampaignFooterRequiredError when its footer is off and its template renders no BrandFooter, and with BrandAddressRequiredError when a brand that signs it off has no postal address.
apiKeyx-api-key<token>id*string^camp_[0-9a-hjkmnp-tv-z]{16,24}$idempotency-key?string1 <= length <= 255application/json- body
scheduledFor?string|nullSuccess
application/json- response
id*CampaignRunId^crun_[0-9a-hjkmnp-tv-z]{16,24}$campaignId*CampaignId^camp_[0-9a-hjkmnp-tv-z]{16,24}$status*string"scheduled""resolving""dispatching""paused""completed""cancelled""failed"scheduledFor*stringidempotencyKey*string|nullstartedAt*string|nullcompletedAt*string|nullcontentSnapshot*||audienceSnapshot*policySnapshot*totalRecipients*numberdispatchedCount*numberfailedCount*numberskippedCount*numberpendingCount*numberskippedReasons*array<>estimatedCompletionAt*string|nullfailureReason*string|nullholdReason*string|nullholdDomainId*|nullholdUntil*string|nullcapacityWarning*string|nulllastContactId*string|nullcreatedBy*string|nullactorEmail*stringmemberRole*stringcreatedAt*stringupdatedAt*stringimport { createClient } from "samva";const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });const result = await samva.campaigns.scheduleRun({ "id": "example"});{ "id": "string", "campaignId": "string", "status": "scheduled", "scheduledFor": "string", "idempotencyKey": "string", "startedAt": "string", "completedAt": "string", "contentSnapshot": { "channel": "email", "email": { "subject": "string", "html": "string", "text": "string", "attachments": [ { "filename": "string", "content": "string", "mediaId": "string", "contentType": "string", "size": 1 } ], "publicationId": "string", "inputContractId": "string", "templateId": "string", "templateSlug": "string", "templateData": { "property1": "string", "property2": "string" }, "locale": "string", "timeZone": "string", "inReplyToMessageId": "string", "replyTo": [ "string" ], "topicId": "string", "tracking": { "opens": true, "clicks": true }, "footer": { "enabled": true }, "headers": { "property1": "string", "property2": "string" }, "preheader": "string" }, "issue": { "path": "string", "commit": "string" }, "from": { "email": "string", "name": "string" }, "replyMailboxId": "string", "conversationId": "string", "metadata": { "property1": "string", "property2": "string" } }, "audienceSnapshot": { "topicId": "string", "includeTags": [ "string" ], "excludeTags": [ "string" ], "contactIds": [ "string" ], "groupIds": [ "string" ] }, "policySnapshot": { "pageSize": 100 }, "totalRecipients": 0, "dispatchedCount": 0, "failedCount": 0, "skippedCount": 0, "pendingCount": 0, "skippedReasons": [ { "reason": "unsubscribed", "count": 0 } ], "estimatedCompletionAt": "string", "failureReason": "string", "holdReason": "string", "holdDomainId": "string", "holdUntil": "string", "capacityWarning": "string", "lastContactId": "string", "createdBy": "string", "actorEmail": "string", "memberRole": "string", "createdAt": "string", "updatedAt": "string"}Related documentation
Resume a campaign run
Resumes a paused campaign run and returns the updated run. Campaigns need a paid plan: on Free this is refused with PaymentRequiredError.
Send a campaign test
Sends one rendered draft email to the authenticated actor's email address, using optional contactId only for personalization.