I've downloaded PHP examples for the SDK Version 2 from this link:
I was wondering if there might be more extensive samples for getting all lists, retreiving all campaigns, delete list, delete campaign, etc, similar to this link, which I think is for the API v1:
This is a great questions, and I unfortunately have to say that we don't currently have extra samples pre-built for the V2 PHP SDK. However, there are a couple things that can make developing easier!
If you have any questions or feedback, please let me know!
Thanks for your reply! I'd like to build an application that gives the user an option to send a test campaign so will likely use the 'sendTest' function in the CampaignScheduleService class.
I've been able to build an application that simply creates and sends a campaign, but we'd like to send a test campaign first, and if we do that, is that test campaign automatically stored in the constant contact account as a draft?
And once the test campaign is sent, and if it's stored as a draft, I would like to give the user the opportunity send that draft as an actual campaign via the 'createSchedule' function in the CampaignScheduleService class. That part I have been able to do, so I think it's the creating and sending a draft first that I need help with - any examples or suggestions would be greatly appreciated.
FYI, that last response was from me signed into a different account 'PortofHoodRiver', who I am building the application for - sorry about the confusion.
Not a problem!
The process for sending a test campaign with our system involves creating a campaign object and then sending that to Constant Contact to create a draft status campaign. Once the campaign has been created (using the addCampaign method of the EmailMarketingService), you can then make use of the testSend() method of the CampaignScheduleService. Here's a quick code sample to demonstrate how this can be done:
$campaign = $emailService->addCampaign($token, $campaignToBeCreated); $testSend = TestSend::create(array("format"=>"HTML", "email_addresses"=>array("email@example.com","firstname.lastname@example.org"))); $scheduleService->sendTest($token, $campaign->id, $testSend);
Additionally, you can read about the limits and restrictions on test sending at the documentation page for this endpoint here: http://developer.constantcontact.com/docs/email-testsend/email-campaign-testsend-api.html
EDIT: I wanted to add that once a draft campaign has been created and a test has been sent, you can then schedule that same campaign after making any modifications that come up when reviewing the test.
If you have any questions, please let me know!
The addCampaign() function is throwing a bad request. There doesn't appear to be any way to enable debugginng in the ConstantContact PHP API. I'd like to see an example of how to construct an instance of $campaignToBeCreated which will pass muster with the API. The API key and access token are correct; other calls are working with them.
Thank you for reaching out to the API Support team here at Constant Contact.
There isn't a method specfically for debuggin in our PHP Wrapper. Any time one of the services runs into an error, it throws a CtctException that contains the the response message (bad request, etc), response code, and any errors JSON formatted in the response body. Your best option is to include code to catch these exceptions so you can see the contents of these errors.
Please let me know if you have any other questions.
API Support Specialist
View API documentation, code samples, get your API key.Visit Page
The holidays have come and gone. For many seasonal businesses, this means the rush of shoppers has decreased as well. Instead of turning off the lights and waiting for spring, make your email marketi...See Article