The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Custom Fields not populating from API generated Campaign

Highlighted
Visitor

Custom Fields not populating from API generated Campaign

Intent:Create custom campaigns that allow our contacts to quickly jump to dynamically updated web content based on our contact's preferences.

 

Documentation References

 

Field Variable Reference:

Contact Property                Variable Name in Email CampaignImport File Column Name
Email address
$SUBSCRIBER.EMAILEmail Address - Work
-or-
Email Address - Home
First name$SUBSCRIBER.FIRSTNAMEFirst name
Last name$SUBSCRIBER.LASTNAMELast name
Mailing address line 1$SUBSCRIBER.ADDRESSLINE1Address Line 1
Mailing address line 2$SUBSCRIBER.ADDRESSLINE2Address Line 2
Mailing address line 3$SUBSCRIBER.ADDRESSLINE3Address Line 3
Mailing address city$SUBSCRIBER.CITYCity
State name$SUBSCRIBER.STATENAMEState
Postal (zip) code$SUBSCRIBER.POSTALCODEZip/Postal Code
Home phone number$SUBSCRIBER.HOMEPHONENUMBER Phone number - Home
Job title$SUBSCRIBER.JOBTITLEJob Title
Custom Field n (n=1-15)   $SUBSCRIBER.CUSTOMTEXTnCustom Field n

 

Expectation

$SUBSCRIBER.CUSTOMTEXT1 would be replaced with the contact s first custom field value. There are 15 custom fields available, to determine which custom field data exists as $SUBSCRIBER.CUSTOMTEXT1 to $SUBSCRIBER.CUSTOMTEXT1 5 add the variables to the campaign's email content in order from 1-15 to make the determination.

 

Example Provided in Documentation

<html>
<body>
<p>Dear $SUBSCRIBER.FIRSTNAME,</p>
<h4>Thank you for being a part of our $SUBSCRIBER.CUSTOMTEXT1 class!</h4>
<p>We thought you'd also like this $SUBSCRIBER.CUSTOMTEXT2 class, offered next $SUBSCRIBER.CUSTOMTEXT3.</p>
<p><a href="http://mydomain.com/classes?email=$SUBSCRIBER.EMAIL">Click here to Register!</a></p>
<p>I hope to see you there!</p>
<p>Sincerely,</p>
<p>Your friends at Wallace Dance Co.</p>
</body>
</html>

 

Campaign JSON Struct Example, modified to include XHTML and $SUBSCRIBER.CUSTOMTEXT1 reference

  1. {
  2. "name": "Test Campaign 1351175725",
  3. "subject": "This Week's Specials",
  4. "from_name": "My Organization",
  5. "from_email": "from-email@example.com",
  6. "reply_to_email": "reply-to-email@example.com",
  7. "status": "DRAFT",
  8. "is_permission_reminder_enabled": true,
  9. "permission_reminder_text": "Hi, just a reminder that you're receiving this email because you have expressed an interest in MyCompany. Don't forget to add from_email@example.com to your address book so we'll be sure to land in your inbox! You may unsubscribe if you no longer wish to receive our emails.",
  10. "is_view_as_webpage_enabled": true,
  11. "view_as_web_page_text": "Having trouble viewing this message?",
  12. "view_as_web_page_link_text": "Click here to view as a Web page",
  13. "greeting_salutations": "Hello",
  14. "greeting_name": "FIRST_NAME",
  15. "greeting_string": "Dear ",
  16. "email_content": "<html><body><p>This is text of the email message. $SUBSCRIBER.CUSTOMTEXT1 </p></body></html>",
  17. "text_content": "This is the text of the email",
  18. "email_content_format": "XHTML",
  19. "style_sheet": "",
  20. "message_footer": {
  21. "organization_name": "Your Organization",
  22. "address_line_1": "123 Maple Street",
  23. "address_line_2": "Unit 1",
  24. "address_line_3": "",
  25. "city": "Anytown",
  26. "state": "MA",
  27. "international_state": "",
  28. "postal_code": "01444",
  29. "country": "US",
  30. "include_forward_email": true,
  31. "forward_email_link_text": "Forward this message to a friend!",
  32. "include_subscribe_link": true,
  33. "subscribe_link_text": "Sign up for our mailing list!"
  34. },
  35. "sent_to_contact_lists": [
  36. {
  37. "id": "1"
  38. }
  39. ]
  40. }

Attempted this and the custom field variable was replaced with blank

  • Attempted adding $SUBSCRIBER.CUSTOMTEXT1
  • $SUBSCRIBER.CUSTOMTEXT2
  • $SUBSCRIBER.CUSTOMTEXT3
  • $SUBSCRIBER.CUSTOMTEXT4
  • $SUBSCRIBER.CUSTOMTEXT5
  • $SUBSCRIBER.CUSTOMTEXT6
  • $SUBSCRIBER.CUSTOMTEXT7
  • $SUBSCRIBER.CUSTOMTEXT8
  • $SUBSCRIBER.CUSTOMTEXT9
  • $SUBSCRIBER.CUSTOMTEXT10
  • $SUBSCRIBER.CUSTOMTEXT11
  • $SUBSCRIBER.CUSTOMTEXT12
  • $SUBSCRIBER.CUSTOMTEXT13
  • $SUBSCRIBER.CUSTOMTEXT14
  • $SUBSCRIBER.CUSTOMTEXT15

Same result, no values populated. Confirmed that contacts custom fields had content.


Additional None Issue

Discovered that subject does not allow custom contact data


Resolution Expectation:

Successful method for referencing contact custom fields when creating a campaign.

2 REPLIES 2
Highlighted
Visitor

Re: Custom Fields not populating from API generated Campaign

Update

When we name a custom field custom_field_1 it can be referenced by $SUBSCRIBER.CUSTOMTEXT1

This does not help us with the 298k contacts we have currently uploaded with named custom fields such as userid.

Highlighted
Honored Contributor

Re: Custom Fields not populating from API generated Campaign

Hello,

 

As you found, the options for merging contact details into custom HTML email campaigns (regardless of if they are created through the API) are currently limited to a set of custom fields that follow the naming scheme you described. This does unfortunately mean that you will not be able to merge contact details from fields that bear a name such as "userid".

 

The best way to resolve this is to re-import the existing contacts with the desired fields for merging stored in new custom fields. You could accomplish this by either using the bulk import functions of our API, which will create fields if they do not yet exist. You can also accomplish your goal by creating the custom fields ahead of time using the format "custom_field_NN" where NN is a number between 1 and 15. Once the fields are created the contacts could be uploaded directly through our UI and simply map the fields on the import files to the desired fields in Constant Contact.

 

If you have any questions, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured