Campaigns

Update messages of a campaign in batch

Changed on

Update up to 100 messages of a campaign in review, each with the fields PATCH /v1/campaigns/:campaignId/messages/:messageId accepts. Each record is updated on its own, in order: one that fails does not prevent the others from being updated. A campaign that is not in review fails the whole request with a 409.

Edit a message of a campaign in review, as the app does: only the fields given change. The content of a message is final, so {{variables}} are rejected, apart from {{signature}} and {{unsubscribeLink}}. A body read back ends with <p>{{signature}}</p> when signed: keep it to keep the message's signature as it is, edited or not; a body without it has no signature. {{unsubscribeLink}} links to the unsubscribe page of that message.

A blank subject or body is rejected. A follow-up sent in the same thread takes no subject; a new subject on a message of the first step carries to the follow-ups of its thread. Edits are lost if the campaign goes back to draft, as its messages are generated again on the next review.<br/><Warning>This endpoint is currently in open beta. The API surface may change as we iterate based on feedback.</Warning>

post/v1/campaigns/{campaignId}/messages/batch/update

Request

  • Base URL
    https://api.folk.app
  • URL
    https://api.folk.app/v1/campaigns/{campaignId}/messages/batch/update
  • Auth
    HTTP bearer

Path parameters

campaignIdstring required

The ID of the campaign.

Headers

Idempotency-Keystring

A unique key, such as a UUID, that makes retrying this request safe: a retry with the same key and body returns the original response without running the operation again. Keys are kept for 24 hours after the request completes.

Example:8e03978e-40d5-43e8-bc93-6894a57f9324

Request body

Example request

{
  "records": [
    {
      "id": "msg_4c8a0e5b-6f1d-4b8a-9d2e-7a3b5c1d9e0f",
      "subject": "Congrats on the round, Ana",
      "body": "<p>Hi Ana, congrats on the round!</p><p>{{signature}}</p>"
    }
  ]
}

Response

The outcome of each record, with each updated message.

deprecationsstring[]

Example response

{
  "data": {
    "results": [
      {
        "status": "succeeded",
        "data": {
          "id": "msg_1d2c3b4a-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
          "campaignId": "cmp_9b2f1c1e-2b8a-4d1e-8f5a-3c2d1e0f9a8b",
          "step": 1,
          "recipient": {
            "contact": {
              "id": "per_55175e81-9a52-4ac3-930e-82792c23499b",
              "entityType": "person"
            },
            "name": "John Doe",
            "email": "john.doe@example.com"
          },
          "sender": {
            "id": "snd_4c3b2a19-8f7e-4d6c-9b5a-1e2f3d4c5b6a",
            "email": "john.doe@example.com",
            "displayName": "John Doe"
          },
          "subject": "Quick question, John",
          "body": "<p>Hi John,</p><p>{{signature}}</p>",
          "cc": [],
          "bcc": [],
          "status": "draft",
          "notSentReason": null,
          "unsubscribed": false
        }
      },
      {
        "status": "failed",
        "error": {
          "code": "NOT_FOUND",
          "message": "Not found.",
          "documentationUrl": "https://developer.folk.app/api-reference/errors#not-found"
        }
      }
    ]
  },
  "deprecations": [
    "This field is deprecated"
  ]
}

Changes