Email Content via API Comes Up Blank

Regular Participant

Email Content via API Comes Up Blank

Hello all,

 

I'm using the PHP version if the ConstantContact API, and can't get the contents of a given compaign. I'm able to connect and list the current newsletters, but when I look at the results of getCampaignDetails, I see the name and other metadata for a given campaign, but emailContent and textVersionContent come up blank. I've also taken a look at the resulting XML feed itself, which also has no content for these fields, nor are they even listed as elements.

 

Help! Thanks so much in advance to anyone who does - I really appreciate it :)

7 REPLIES 7
Employee

Hey Lanette,

 

You should be able to see the emailContent node from with in the getCampaigndetails method.  Try running thise code with in wrapper and see if it does not return anything.

 

for($x = 0; $x < 10; $x++)
{
	echo "<br><br>";
	echo "<pre>";
	print_r($ConstantContact->getCampaignDetails($campaigns['campaigns'][$x]));
	echo "</pre>";
}

 That will output your 1st 10 campaigns. 

 

If they still do not show it up, it is possible that the particular email is using a template then you will not see the nodes as you cant modify template campaigns through the API.

 

you can get this information from :

[campaignType] => STOCK

 
Please let me know if this helps.

Ryan Davis
Quality Engineer
Regular Participant

Thanks for getting back to me.

 

I used the following code:

$cc=new CampaignsCollection();
// ... code that isolates the specific Campaign instance => $campaign ...
$details=$cc->listCampaignDetails($campaign);
var_dump($details);

and of the results, the following are to note:

 

You can see that the campaign is correctly being retrieved via the API:

  ["campaignName:private"]=>
  object(SimpleXMLElement)#544 (1) {
    [0]=>
    string(54) "CC of Copy of September 2011 - Budgeting Your Business"
  }
  ["id:private"]=>
  object(SimpleXMLElement)#849 (1) {
    [0]=>
    string(74) "http://api.constantcontact.com/ws/customers/pfgnet/campaigns/1107748769417"
  }
  ["link:private"]=>
  object(SimpleXMLElement)#543 (1) {
    [0]=>
    string(44) "/ws/customers/pfgnet/campaigns/1107748769417"
  }
  ["status:private"]=>
  object(SimpleXMLElement)#545 (1) {
    [0]=>
    string(4) "Sent"
  }

 But then these fields are coming up blank:

 ["emailContentFormat:private"]=>
  object(SimpleXMLElement)#882 (0) {
  }
  ["emailContent:private"]=>
  object(SimpleXMLElement)#883 (0) {
  }
  ["textVersionContent:private"]=>
  object(SimpleXMLElement)#884 (0) {
  }

I hope this clarifies my issue, and maybe what I can do to fix it. Please let me know - thanks! 

Hey Lanette,

 

Which wrapper are you using?  At first glance I thought you were using our new PHP wrapper but the results are extremely different.  Please let me know so i can better assist.

Ryan Davis
Quality Engineer
Regular Participant

This one:

/* @name ctctWrapper.php
 * @author Constant Contact API Support Team <webservices@constantcontact.com> 
 * @version 1.0
 * @link http://developer.constantcontact.com
 * @package ctctWrapper
 */

 Hope this helps - thanks!

The wrapper appears to be working correctly.  The Campaign you were trying to retrieve is based of one of our editor templates.  We do not currently expose the content of template emails through the API, only custom HTML/XHTML templates.  So, when pulling the details of one of our template campaigns, those nodes would be empty/blank. 

Dave Berard
Senior Product Manager, Constant Contact

I see, do you offer any other solution to embedding these saved campaigns in my website? I'm looking for a dynamic way to take all these campaigns and have them accessible at any time to users via my website.

 

Thanks for everything!

There are two options you have for providing external links for sent email campaigns through your website.  The first is the SharePageURL parameter (provided you enabled social sharing).  This is a dynamically generated web version of your campaign.  This is a good option for just providing the online content.  It would appear like this:

 

<SharePageURL>http://myemail.constantcontact.com/News-from-Constant-Contact.html?soid=1101987804725&amp;aid=qYpttx...</SharePageURL>

 

The second option requires our Archive addon.  This will provide a permanent version of your email that is also search engine crawlable. This would allow search engines to find your email content and then it will show up in appropriate searches.  This node would look like this:

 

<ArchiveURL>http://archive.constantcontact.com/fs043/1101987804725/archive/1107291354618.html</ArchiveURL>

Both of these options will provide you with a link you can then display on your website. When the links are clicked, they will be brought to a hosted version of your email provided by Constant Contact

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page