Make a GET call to the emails/activities/{campaign_activity_id}
endpoint to obtain the email content, metadata, and styling information of an email campaign activity.
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
5 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.
Before You Begin
In order to get the email content of a specific email campaign activity, you must obtain a campaign_activity_id
:
-
Make a GET call against the email campaign collection endpoint.
GET https://api.cc.email/v3/emailsThe method returns a paginated list of all email campaigns in your account.
-
Use the list of email campaigns to obtain the
campaign_id
value for an specific email campaign. -
Make a GET call against the individual email campaign endpoint using your chosen
campaign_id
value.GET https://api.cc.email/v3/emails/{campaign_id}The method returns an array of
campaign_activity_id
androle
values for each email campaign activity that is associated with your chosen email campaign.
When you create an email campaign, the V3 API also returns the campaign_activity_id
and role
values of the email campaign activities that are associated with the email campaign.
Get an Email Campaign Activity
Retrieve an email campaign activity by making a GET call to the emails/activities/{campaign_activity_id}
endpoint.
Authorization Requirements
User privileges: campaign:read
Authorization scopes: campaign_data
Parameters
This GET call requires the campaign_activity_id
URL parameter. Use the campaign_activity_id
to specify the email campaign activity that you want to retrieve.
Use the optional include
query parameter to enter a comma separated list of email campaign activity subresources for the method to return in the response body. Valid values are:
- permalink_url
- html_content
- document_properties
- physical_address_in_footer
For example, this request URL includes the permalink_url
and physical_address_in_footer
subresources:
https://api.cc.email/v3/emails/activities/{campaign_activity_id}?include=permalink_url,physical_address_in_footer
This method will return a 400 error if you include a subresource in the include
query parameter that does not apply to the resource you are retrieving. There are minor differences in schema and usage of subresource between email format types.
Format Type Schema Differences
There are minor differences in the email campaign activity schema for the different email format types.
-
Format type 1 and 2 emails support a
document_properties
object. This object contains configuration information for the legacy email format types. The other format types do not. -
Format type 3, 4, and 5 support the
preheader
property. The other format types do not. -
Format type 3, 4, and 5 support adding an array of
segment_ids
to the email campaign. The other format types do not. Though you can add segments to an email, the V3 API does not currently provide methods to create or retrieve segments. -
Format type 3, 4, and 5 support an
address_optional
property in thephysical_address_in_footer
object. The other format types do not. -
Format type 1 and 5 (the custom code format types) support the
html_content
property. The other format types do not.
Example Get Email Campaign Activity Call
This example GET call returns an email campaign activity and includes html_content
, permalink_url
and physical_address_in_footer
in the response.
GET https://api.cc.email/v3/emails/activities/{campaign_activity_id}?include=html_content,permalink_url,physical_address_in_footer
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/emails/activities/58cfcf5b-0c8e-4bab-8816-360b46b50d7e');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'include' => 'physical_address_in_footer,permalink_url,html_content'
));
$request->setHeaders(array(
'Postman-Token' => '49aaef36-3de4-4a1e-8a0c-54624a3e077b',
'cache-control' => 'no-cache',
'Authorization' => 'Bearer {access_token}'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cc.email/v3/emails/activities/58cfcf5b-0c8e-4bab-8816-360b46b50d7e?include=physical_address_in_footer,permalink_url,html_content")
.get()
.addHeader("Authorization", "Bearer {access_token}")
.addHeader("cache-control", "no-cache")
.addHeader("Postman-Token", "2a0a5652-af1b-45f9-8cc9-79db34634ac4")
.build();
Response response = client.newCall(request).execute();
curl -X GET \
'https://api.cc.email/v3/emails/activities/58cfcf5b-0c8e-4bab-8816-360b46b50d7e?include=physical_address_in_footer,permalink_url,html_content' \
-H 'Authorization: Bearer {access_token}' \
-H 'Postman-Token: b3d0ae34-3d05-4974-a236-f549d38cfe1c' \
-H 'cache-control: no-cache'
Response
{
"campaign_activity_id": "e0ab1df0-5b85-4851-bd0d-e1da40999733",
"campaign_id": "eb2554a6-48bc-4ab8-a954-615e1d5a82f1",
"role": "primary_email",
"contact_list_ids": [
"da10f460-3072-11e9-b282-fa163e6b01c1"
],
"segment_ids": [],
"current_status": "DRAFT",
"format_type": 5,
"from_email": "jdodge@constantcontact.com",
"from_name": "Jake Dodge",
"reply_to_email": "jdodge@constantcontact.com",
"subject": "Our Holiday Specials",
"html_content": "<html><body> <a href=\"http://www.constantcontact.com\">Visit ConstantContact.com!</a> </body></html>",
"template_id": "1000755366001",
"permalink_url": "https://conta.cc/2EF61xH",
"physical_address_in_footer": {
"address_line1": "123 Maple Street",
"address_line2": "Unit 1",
"address_line3": "string",
"city": "Boston",
"country_code": "en",
"country_name": "United States",
"organization_name": "Jake Dodge's Pancakes",
"postal_code": "02451"
}
}