Link Search Menu Expand Document

Updated Fri May 20th 2022, 18:30 UTC

Update

PUT /campaigns/:campaign

A Campaign is a message sent to multiple recipients.

Examples

Update a Campaign

Request

PUT /campaigns/1zO27OO

Body

{
  "title": "Updated campaign title",
  "message_body": "Updated message body",
  "scheduled_at": "2040-11-19T23:00:00Z"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /campaigns/1zO27OO
     -d '{json: "body"}' 

Response

Status

200

Response Type

Campaign

Example
{
  "@type": "Campaign",
  "@context": "/contexts/Campaign.jsonld",
  "id": "/campaigns/joOQd57",
  "title": "The Best Campaign",
  "messageBody": "The best campaign message.",
  "state": "sent",
  "type": "single",
  "schedule": null,
  "createdAt": "2018-11-19T20:51:54.000Z",
  "scheduledAt": "2018-11-19T21:00:54.000Z",
  "sendingStartAt": null,
  "sendingEndAt": null,
  "estimatedStartAt": null,
  "estimatedFinishAt": null,
  "deliveryStatistics": {},
  "delete": "/campaigns/joOQd57",
  "edit": "/campaigns/joOQd57",
  "cancel": "/campaigns/joOQd57/cancel",
  "account": "/accounts/my_account",
  "group": null,
  "user": {
    "@type": "User",
    "@context": "/contexts/User.jsonld",
    "id": "/users/wqyODPA",
    "name": "Chuck Norris",
    "firstName": "Chuck",
    "lastName": "Norris",
    "email": "chuck@textus.example",
    "avatar": null,
    "automatedActor": false,
    "hasPassword": false,
    "discarded": false,
    "settings": {
      "notifications": {
        "email": true
      },
      "customSettings": {}
    },
    "memberships": "/users/wqyODPA/memberships"
  },
  "totalRecipients": "/campaigns/AJoOVb7/campaign_recipients/total",
  "skippedRecipients": "/campaigns/AJoOVb7/campaign_recipients/skipped",
  "sentRecipients": "/campaigns/AJoOVb7/campaign_recipients/sent",
  "deliveredRecipients": "/campaigns/AJoOVb7/campaign_recipients/delivered",
  "repliedRecipients": "/campaigns/AJoOVb7/campaign_recipients/replied",
  "unrepliedRecipients": "/campaigns/AJoOVb7/campaign_recipients/unreplied",
  "failedRecipients": "/campaigns/AJoOVb7/campaign_recipients/failed",
  "lastSentAt": null,
  "attachments": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/campaigns/AJoOVb7/campaign_attachments",
    "members": [],
    "totalItems": 0
  },
  "campaignTemplates": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/campaigns/joOQd57/templates",
    "members": [
      {
        "@type": "CampaignTemplate",
        "@context": "/contexts/CampaignTemplate.jsonld",
        "id": "/campaigns/joOQd57/templates/BYoaNE",
        "sortOrder": 1,
        "messageBody": "hi",
        "attachments": {
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "id": "/campaigns/AJoOVb7/campaign_attachments",
          "members": [
            {
              "@type": "Attachment",
              "@context": "/contexts/Attachment.jsonld",
              "id": "/campaign_attachments/7LdVlM",
              "url": "https://foo.cloudfront.net/bar1234=",
              "downloadUrl": "https://s3.amazonaws.com/attachments",
              "key": "abc123.png",
              "contentType": "image/png",
              "size": 6829,
              "width": 101,
              "height": 128,
              "originalFilename": "original"
            }
          ],
          "totalItems": 1
        },
        "registeredLinks": {
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "id": "/campaigns/bK9DjpX/templates/bK9DjpX/links",
          "members": [
            {
              "@type": "CampaignRegisteredLink",
              "@context": "/contexts/CampaignRegisteredLink.jsonld",
              "id": "/campaigns/bK9DjpX/templates/bK9DjpX/links/BYoaNE",
              "shortLink": "https://cattaps.textus-stg.app/6Tb1mk",
              "originalLink": "https://xkcd.com",
              "clickCount": 9
            }
          ],
          "totalItems": 1
        },
        "deliveryStatistics": {
          "total": 1,
          "skipped": 0,
          "sent": 1,
          "delivered": 1,
          "replied": 0,
          "unreplied": 1,
          "failed": 0
        },
        "totalRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/total",
        "skippedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/skipped",
        "sentRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/sent",
        "deliveredRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/delivered",
        "failedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/failed",
        "repliedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/replied",
        "unrepliedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/unreplied"
      }
    ],
    "totalItems": 1
  }
}

Update a recurring Campaign

Request

PUT /campaigns/bK9DjpX

Body

{
  "schedule": "FREQ=WEEKLY;BYHOUR=15;BYMINUTE=3"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /campaigns/bK9DjpX
     -d '{json: "body"}' 

Response

Status

200

Response Type

Campaign

Example
{
  "@type": "Campaign",
  "@context": "/contexts/Campaign.jsonld",
  "id": "/campaigns/joOQd57",
  "title": "The Best Campaign",
  "messageBody": "The best campaign message.",
  "state": "sent",
  "type": "single",
  "schedule": "FREQ=WEEKLY;BYHOUR=15;BYMINUTE=3",
  "createdAt": "2018-11-19T20:51:54.000Z",
  "scheduledAt": null,
  "sendingStartAt": null,
  "sendingEndAt": null,
  "estimatedStartAt": null,
  "estimatedFinishAt": null,
  "deliveryStatistics": {},
  "delete": "/campaigns/joOQd57",
  "edit": "/campaigns/joOQd57",
  "cancel": "/campaigns/joOQd57/cancel",
  "account": "/accounts/my_account",
  "group": "/groups/bK9DjpX",
  "user": {
    "@type": "User",
    "@context": "/contexts/User.jsonld",
    "id": "/users/wqyODPA",
    "name": "Chuck Norris",
    "firstName": "Chuck",
    "lastName": "Norris",
    "email": "chuck@textus.example",
    "avatar": null,
    "automatedActor": false,
    "hasPassword": false,
    "discarded": false,
    "settings": {
      "notifications": {
        "email": true
      },
      "customSettings": {}
    },
    "memberships": "/users/wqyODPA/memberships"
  },
  "totalRecipients": "/campaigns/AJoOVb7/campaign_recipients/total",
  "skippedRecipients": "/campaigns/AJoOVb7/campaign_recipients/skipped",
  "sentRecipients": "/campaigns/AJoOVb7/campaign_recipients/sent",
  "deliveredRecipients": "/campaigns/AJoOVb7/campaign_recipients/delivered",
  "repliedRecipients": "/campaigns/AJoOVb7/campaign_recipients/replied",
  "unrepliedRecipients": "/campaigns/AJoOVb7/campaign_recipients/unreplied",
  "failedRecipients": "/campaigns/AJoOVb7/campaign_recipients/failed",
  "lastSentAt": null,
  "attachments": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/campaigns/AJoOVb7/campaign_attachments",
    "members": [],
    "totalItems": 0
  },
  "campaignTemplates": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/campaigns/joOQd57/templates",
    "members": [
      {
        "@type": "CampaignTemplate",
        "@context": "/contexts/CampaignTemplate.jsonld",
        "id": "/campaigns/joOQd57/templates/BYoaNE",
        "sortOrder": 1,
        "messageBody": "hi",
        "attachments": {
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "id": "/campaigns/AJoOVb7/campaign_attachments",
          "members": [
            {
              "@type": "Attachment",
              "@context": "/contexts/Attachment.jsonld",
              "id": "/campaign_attachments/7LdVlM",
              "url": "https://foo.cloudfront.net/bar1234=",
              "downloadUrl": "https://s3.amazonaws.com/attachments",
              "key": "abc123.png",
              "contentType": "image/png",
              "size": 6829,
              "width": 101,
              "height": 128,
              "originalFilename": "original"
            }
          ],
          "totalItems": 1
        },
        "registeredLinks": {
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "id": "/campaigns/bK9DjpX/templates/bK9DjpX/links",
          "members": [
            {
              "@type": "CampaignRegisteredLink",
              "@context": "/contexts/CampaignRegisteredLink.jsonld",
              "id": "/campaigns/bK9DjpX/templates/bK9DjpX/links/BYoaNE",
              "shortLink": "https://cattaps.textus-stg.app/6Tb1mk",
              "originalLink": "https://xkcd.com",
              "clickCount": 9
            }
          ],
          "totalItems": 1
        },
        "deliveryStatistics": {
          "total": 1,
          "skipped": 0,
          "sent": 1,
          "delivered": 1,
          "replied": 0,
          "unreplied": 1,
          "failed": 0
        },
        "totalRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/total",
        "skippedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/skipped",
        "sentRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/sent",
        "deliveredRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/delivered",
        "failedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/failed",
        "repliedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/replied",
        "unrepliedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/unreplied"
      }
    ],
    "totalItems": 1
  }
}

Stop a recurring Campaign

Request

PUT /campaigns/bK9DjpX

Body

{
  "state": "canceled"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /campaigns/bK9DjpX
     -d '{json: "body"}' 

Response

Status

200

Response Type

Campaign

Example
{
  "@type": "Campaign",
  "@context": "/contexts/Campaign.jsonld",
  "id": "/campaigns/joOQd57",
  "title": "The Best Campaign",
  "messageBody": "The best campaign message.",
  "state": "canceled",
  "type": "single",
  "schedule": "FREQ=DAILY;BYHOUR=15;BYMINUTE=3",
  "createdAt": "2018-11-19T20:51:54.000Z",
  "scheduledAt": null,
  "sendingStartAt": null,
  "sendingEndAt": null,
  "estimatedStartAt": null,
  "estimatedFinishAt": null,
  "deliveryStatistics": {},
  "delete": null,
  "edit": null,
  "cancel": null,
  "account": "/accounts/my_account",
  "group": "/groups/bK9DjpX",
  "user": {
    "@type": "User",
    "@context": "/contexts/User.jsonld",
    "id": "/users/wqyODPA",
    "name": "Chuck Norris",
    "firstName": "Chuck",
    "lastName": "Norris",
    "email": "chuck@textus.example",
    "avatar": null,
    "automatedActor": false,
    "hasPassword": false,
    "discarded": false,
    "settings": {
      "notifications": {
        "email": true
      },
      "customSettings": {}
    },
    "memberships": "/users/wqyODPA/memberships"
  },
  "totalRecipients": "/campaigns/AJoOVb7/campaign_recipients/total",
  "skippedRecipients": "/campaigns/AJoOVb7/campaign_recipients/skipped",
  "sentRecipients": "/campaigns/AJoOVb7/campaign_recipients/sent",
  "deliveredRecipients": "/campaigns/AJoOVb7/campaign_recipients/delivered",
  "repliedRecipients": "/campaigns/AJoOVb7/campaign_recipients/replied",
  "unrepliedRecipients": "/campaigns/AJoOVb7/campaign_recipients/unreplied",
  "failedRecipients": "/campaigns/AJoOVb7/campaign_recipients/failed",
  "lastSentAt": null,
  "attachments": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/campaigns/AJoOVb7/campaign_attachments",
    "members": [],
    "totalItems": 0
  },
  "campaignTemplates": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/campaigns/joOQd57/templates",
    "members": [
      {
        "@type": "CampaignTemplate",
        "@context": "/contexts/CampaignTemplate.jsonld",
        "id": "/campaigns/joOQd57/templates/BYoaNE",
        "sortOrder": 1,
        "messageBody": "hi",
        "attachments": {
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "id": "/campaigns/AJoOVb7/campaign_attachments",
          "members": [
            {
              "@type": "Attachment",
              "@context": "/contexts/Attachment.jsonld",
              "id": "/campaign_attachments/7LdVlM",
              "url": "https://foo.cloudfront.net/bar1234=",
              "downloadUrl": "https://s3.amazonaws.com/attachments",
              "key": "abc123.png",
              "contentType": "image/png",
              "size": 6829,
              "width": 101,
              "height": 128,
              "originalFilename": "original"
            }
          ],
          "totalItems": 1
        },
        "registeredLinks": {
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "id": "/campaigns/bK9DjpX/templates/bK9DjpX/links",
          "members": [
            {
              "@type": "CampaignRegisteredLink",
              "@context": "/contexts/CampaignRegisteredLink.jsonld",
              "id": "/campaigns/bK9DjpX/templates/bK9DjpX/links/BYoaNE",
              "shortLink": "https://cattaps.textus-stg.app/6Tb1mk",
              "originalLink": "https://xkcd.com",
              "clickCount": 9
            }
          ],
          "totalItems": 1
        },
        "deliveryStatistics": {
          "total": 1,
          "skipped": 0,
          "sent": 1,
          "delivered": 1,
          "replied": 0,
          "unreplied": 1,
          "failed": 0
        },
        "totalRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/total",
        "skippedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/skipped",
        "sentRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/sent",
        "deliveredRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/delivered",
        "failedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/failed",
        "repliedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/replied",
        "unrepliedRecipients": "/campaigns/joOQd57/templates/joOQd57/recipients/unreplied"
      }
    ],
    "totalItems": 1
  }
}

© 2022 TextUs