Update an email campaign activity.

Make a PUT call to the /emails/activities/{campaign_activity_id} endpoint to update an email campaign activity. This includes updating the contact_list_ids array to specify which contacts Constant Contact should send the email campaign activity to. You must add contacts to an email campaign activity in order to schedule it.

Email Campaign Activity Object Structure

The email campaign activity object contains the email header content, the email body content, the contacts lists or segments associated with the email, and the email metadata. The email headers are in the from_name, from_email, reply_to_email, and subject properties. The contacts that Constant Contact sends the email campaign activity to are in the contact_list_ids array or the segment_ids array. The html_content property contains the email body content for format_type 1 emails (custom code emails). The other format_type emails do not contain html_content.

The email campaign activity object also contains a physical_address_in_footer object and a document_properties object. The physical_address_in_footer object contains the address information for the organization sending the email campaign. Constant Contact displays this address information to contacts in the email footer. The document_properties object contains optional properties that are specific to each email format_type and control the behavior of the email. For more information on document_properties, see the reference documentation for GET a Single Email Campaign Activity.

Update an Email Campaign Activity

Update an email campaign activity by making a PUT call to the /emails/activities/{campaign_activity_id} endpoint. Include the complete email campaign activity with your updates in the request body.

You can only update email campaign activities that have the primary_email role. You can update email campaign activities when they are in Draft status for each email campaign activity format_type. You can also update email campaign activities when they are in Done status if the email campaign activity uses format_type 3.

Specify which contacts Constant Contact should send the email campaign activity to using the contact_list_ids array. The contact_list_ids array contains unique contact list_id string values. Use the GET /contact_lists collection endpoint to return a paginated list of all available contact lists.

Though you can also use the segment_ids array instead of the contact_list_ids array to specify who should receive an email, the full segmentation workflow is not currently supported. The V3 API does not provide methods for creating new segments or getting segment_id values yet. Only email campaign activities that use format_type 3 can contain segments. Constant Contact users can create new segments and add segments to emails through the UI.

You must add contacts to an email campaign activity using either the contact_list_ids array or the segment_ids array in order to schedule it.

Authorization Requirements

User privileges: campaign:write

Authorization scopes: campaign_data

Request Parameters

This method requires the campaign_activity_id URL parameter. Use the campaign_activity_id parameter to specify which email campaign activity you want to update.

This method requires a request body that contains the from_name, from_email, reply_to_email and subject properties.

When you use a PUT method to update a resource, the V3 API overwrites any properties that are missing in the request body. However, this method does not overwrite subresources that you omit in the request body or missing properties in subresources. This method considers physical_address_in_footer, document_properties, html_content, and permalink_url subresources.

Example PUT Email Campaign Activity Call

This example PUT call updates an email campaign activity that uses format_type 1. This example PUT call also adds two contact lists to the email campaign activity.

PUT https://api.cc.email/v3/emails/activities/{campaign_activity_id}

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/emails/activities/592fd1c9-44e8-49f1-945f-f04ee57c1e85');
$request->setMethod(HTTP_METH_PUT);

$request->setHeaders(array(
  'Postman-Token' => '93c0c6f6-32cc-422f-97e9-e606973b0489',
  'cache-control' => 'no-cache',
  'Authorization' => 'Bearer {access_token}',
  'Content-Type' => 'application/json'
));

$request->setBody('{
  "campaign_activity_id": "592fd1c9-44e8-49f1-945f-f04ee57c1e85",
  "campaign_id": "8987dc1a-48ef-433a-b836-7ca4f9aa3481",
  "role": "primary_email",
  "current_status": "Draft",
  "contact_list_ids": ["f4ab800a-5adf-11e9-ba6a-fa163e6b01c1","da10f460-3072-11e9-b282-fa163e6b01c1"],
  "format_type": 1,
  "from_email": "jake_dodge@jakedodgepancakes.com",
  "from_name": "Jake Dodge",
  "reply_to_email": "jake_dodge@jakedodgepancakes.com",
  "subject": "Our Second Annual Holiday Newsletter",
  "html_content": "<html><body> <a href=\\"http://www.constantcontact.com\\">Visit ConstantContact.com!</a> </body></html>",
  "template_id": "1000755366001",
  "permalink_url": "https://conta.cc/2GaQ8AY",
  "physical_address_in_footer": {
    "address_line1": "123 Maple Street",
    "address_line2": "Unit 1",
    "address_line3": "string",
    "address_optional": "Near Boston Fire Station",
    "city": "Boston",
    "country_code": "US",
    "country_name": "United States",
    "organization_name": "Jake Dodge's Pancakes",
    "postal_code": "02451",
    "state_code": "MA",
    "state_name": "string",
    "state_non_us_name": "Victoria"
  },
  "document_properties": {
    "style_content": ".white{color: #ffffff;}",
    "letter_format": "XHTML",
    "greeting_salutation": "Dear",
    "greeting_name_type": "F",
    "greeting_secondary": "Greetings!",
    "text_content": "<Text><Greeting/></Text>",
    "permission_reminder_enabled": "false",
    "permission_reminder": "Hi, just a reminder that you're receiving this email because you have expressed an interest in our company.",
    "view_as_webpage_enabled": "false",
    "view_as_webpage_text": "Having trouble viewing this email?",
    "view_as_webpage_link_name": "Click here to view this email as a web page",
    "forward_email_link_enabled": "true",
    "forward_email_link_name": "Forward email",
    "subscribe_link_enabled": "false",
    "subscribe_link_name": "Subscribe to my email list!"
  }
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"campaign_activity_id\": \"592fd1c9-44e8-49f1-945f-f04ee57c1e85\",\n  \"campaign_id\": \"8987dc1a-48ef-433a-b836-7ca4f9aa3481\",\n  \"role\": \"primary_email\",\n  \"current_status\": \"Draft\",\n  \"contact_list_ids\": [\"f4ab800a-5adf-11e9-ba6a-fa163e6b01c1\",\"da10f460-3072-11e9-b282-fa163e6b01c1\"],\n  \"format_type\": 1,\n  \"from_email\": \"jake_dodge@jakedodgepancakes.com\",\n  \"from_name\": \"Jake Dodge\",\n  \"reply_to_email\": \"jake_dodge@jakedodgepancakes.com\",\n  \"subject\": \"Our Second Annual Holiday Newsletter\",\n  \"html_content\": \"<html><body> <a href=\\\"http://www.constantcontact.com\\\">Visit ConstantContact.com!</a> </body></html>\",\n  \"template_id\": \"1000755366001\",\n  \"permalink_url\": \"https://conta.cc/2GaQ8AY\",\n  \"physical_address_in_footer\": {\n    \"address_line1\": \"123 Maple Street\",\n    \"address_line2\": \"Unit 1\",\n    \"address_line3\": \"string\",\n    \"address_optional\": \"Near Boston Fire Station\",\n    \"city\": \"Boston\",\n    \"country_code\": \"US\",\n    \"country_name\": \"United States\",\n    \"organization_name\": \"Jake Dodge's Pancakes\",\n    \"postal_code\": \"02451\",\n    \"state_code\": \"MA\",\n    \"state_name\": \"string\",\n    \"state_non_us_name\": \"Victoria\"\n  },\n  \"document_properties\": {\n    \"style_content\": \".white{color: #ffffff;}\",\n    \"letter_format\": \"XHTML\",\n    \"greeting_salutation\": \"Dear\",\n    \"greeting_name_type\": \"F\",\n    \"greeting_secondary\": \"Greetings!\",\n    \"text_content\": \"<Text><Greeting/></Text>\",\n    \"permission_reminder_enabled\": \"false\",\n    \"permission_reminder\": \"Hi, just a reminder that you're receiving this email because you have expressed an interest in our company.\",\n    \"view_as_webpage_enabled\": \"false\",\n    \"view_as_webpage_text\": \"Having trouble viewing this email?\",\n    \"view_as_webpage_link_name\": \"Click here to view this email as a web page\",\n    \"forward_email_link_enabled\": \"true\",\n    \"forward_email_link_name\": \"Forward email\",\n    \"subscribe_link_enabled\": \"false\",\n    \"subscribe_link_name\": \"Subscribe to my email list!\"\n  }\n}");
Request request = new Request.Builder()
  .url("https://api.cc.email/v3/emails/activities/592fd1c9-44e8-49f1-945f-f04ee57c1e85")
  .put(body)
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("cache-control", "no-cache")
  .addHeader("Postman-Token", "3e2dfe28-c699-400a-97d6-f9dca18c4ac9")
  .build();

Response response = client.newCall(request).execute();
curl -X PUT \
  https://api.cc.email/v3/emails/activities/592fd1c9-44e8-49f1-945f-f04ee57c1e85 \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: 7f6d2775-5090-4198-9055-2dfe11befde4' \
  -H 'cache-control: no-cache' \
  -d '{
  "campaign_activity_id": "592fd1c9-44e8-49f1-945f-f04ee57c1e85",
  "campaign_id": "8987dc1a-48ef-433a-b836-7ca4f9aa3481",
  "role": "primary_email",
  "current_status": "Draft",
  "contact_list_ids": ["f4ab800a-5adf-11e9-ba6a-fa163e6b01c1","da10f460-3072-11e9-b282-fa163e6b01c1"],
  "format_type": 1,
  "from_email": "jake_dodge@jakedodgepancakes.com",
  "from_name": "Jake Dodge",
  "from_email": "jake_dodge@jakedodgepancakes.com",
  "subject": "Our Second Annual Holiday Newsletter",
  "html_content": "<html><body> <a href=\"http://www.constantcontact.com\">Visit ConstantContact.com!</a> </body></html>",
  "template_id": "1000755366001",
  "permalink_url": "https://conta.cc/2GaQ8AY",
  "physical_address_in_footer": {
    "address_line1": "123 Maple Street",
    "address_line2": "Unit 1",
    "address_line3": "string",
    "address_optional": "Near Boston Fire Station",
    "city": "Boston",
    "country_code": "US",
    "country_name": "United States",
    "organization_name": "Jake Dodge'\''s Pancakes",
    "postal_code": "02451",
    "state_code": "MA",
    "state_name": "string",
    "state_non_us_name": "Victoria"
  },
  "document_properties": {
    "style_content": ".white{color: #ffffff;}",
    "letter_format": "XHTML",
    "greeting_salutation": "Dear",
    "greeting_name_type": "F",
    "greeting_secondary": "Greetings!",
    "text_content": "<Text><Greeting/></Text>",
    "permission_reminder_enabled": "false",
    "permission_reminder": "Hi, just a reminder that you'\''re receiving this email because you have expressed an interest in our company.",
    "view_as_webpage_enabled": "false",
    "view_as_webpage_text": "Having trouble viewing this email?",
    "view_as_webpage_link_name": "Click here to view this email as a web page",
    "forward_email_link_enabled": "true",
    "forward_email_link_name": "Forward email",
    "subscribe_link_enabled": "false",
    "subscribe_link_name": "Subscribe to my email list!"
  }
}'

Response

{
    "campaign_activity_id": "592fd1c9-44e8-49f1-945f-f04ee57c1e85",
    "campaign_id": "a0c0e7bc-53ce-4b87-8080-c23caccbb804",
    "role": "primary_email",
    "contact_list_ids": [
        "da10f460-3072-11e9-b282-fa163e6b01c1",
        "f4ab800a-5adf-11e9-ba6a-fa163e6b01c1"
    ],
    "segment_ids": [],
    "current_status": "DRAFT",
    "format_type": 1,
    "from_email": "jake_dodge@jakedodgepancakes.com",
    "from_name": "Jake Dodge",
    "reply_to_email": "jake_dodge@jakedodgepancakes.com",
    "subject": "Our Second Annual Holiday Newsletter",
    "html_content": "<html><body> <a href=\"http://www.constantcontact.com\">Visit ConstantContact.com!</a> </body></html>",
    "template_id": "1000755366001",
    "physical_address_in_footer": {
        "address_line1": "123 Maple Street",
        "address_line2": "Unit 1",
        "address_line3": "string",
        "city": "Boston",
        "state_code": "MA",
        "state_name": "Massachusetts",
        "postal_code": "02451",
        "country_code": "US"
    },
    "document_properties": {
        "letter_format": "XHTML",
        "greeting_salutation": "Dear",
        "greeting_name_type": "F",
        "greeting_secondary": "Greetings!",
        "subscribe_link_enabled": "false",
        "text_content": "<Text><Greeting/></Text>",
        "permission_reminder_enabled": "false",
        "view_as_webpage_enabled": "false",
        "forward_email_link_enabled": "true",
        "forward_email_link_name": "Forward email"
    }
}

Try it!