Skip to Content

Update a campaign

Updates the name, content, audience, or policy of a campaign draft. Request: PATCH /v1/campaigns/{id}. Scope: messages:update.

PATCH
/v1/campaigns/{id}

Updates the name, content, audience, or policy of a campaign draft.

Authorization

apiKey
headerx-api-key<token>

Path Parameters

id*string
Match^camp_[0-9a-hjkmnp-tv-z]{16,24}$

Request Body

application/json
  1. body
name?|null
content?|||null
audience?|null
policy?|null

Response Body

Campaign

application/json
  1. response
id*CampaignId
Match^camp_[0-9a-hjkmnp-tv-z]{16,24}$
name*string
channel*string
Value in"sms""whatsapp""email"
content*||
audience*
policy*
definition*
latestRun*|null
createdBy*string|null
actorEmail*string
memberRole*string
createdAt*string
updatedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.campaigns.update({
  "id": "example"
});
Example Response
{
  "id": "string",
  "name": "string",
  "channel": "sms",
  "content": {
    "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"
    }
  },
  "audience": {
    "topicId": "string",
    "includeTags": [
      "string"
    ],
    "excludeTags": [
      "string"
    ],
    "contactIds": [
      "string"
    ],
    "groupIds": [
      "string"
    ]
  },
  "policy": {
    "pageSize": 100
  },
  "definition": {
    "state": "editable",
    "frozenAt": "string"
  },
  "latestRun": {
    "id": "string",
    "status": "scheduled",
    "scheduledFor": "string",
    "completedAt": "string",
    "totalRecipients": 0,
    "dispatchedCount": 0,
    "failedCount": 0,
    "skippedCount": 0,
    "pendingCount": 0,
    "estimatedCompletionAt": "string"
  },
  "createdBy": "string",
  "actorEmail": "string",
  "memberRole": "string",
  "createdAt": "string",
  "updatedAt": "string"
}

Related documentation