I'm pretty fluent in PHP, but haven't really used APIs much before, so I'm a bit lost with how to get started with the Constant Contact API.
Our website accepts customer data through several contact and signup forms. We have to process most of this data for other reasons, so it's being stored in a variety of databases. All I want to do is set up a PHP script that I can run by cron several times per day, that will go through these separate databases, compile a list of contacts who have opted in to our lists, and add them to the corresponding Constant Contact lists.
It seems simple enough, but there's a concept or two that I'm failing to grasp about the API and I can't quite figure out which key bit(s) of information I'm missing. Would appreciate any guidance on getting started on this project, especially since my deadline is less than a week away!
You have a couple of options here. The simplest option would probably be to add the contacts to Constant Contact as they opt in, instead of doing a bulk upload using your cron later. You can download our PHP wrapper here, and use the addUpdate example (in the examples folder) as a jumping off point.
The other option is waiting, compiling the email addresses to be opted in, and posting them to our activities API, which handles bulk uploads (more than one contact at a time).
Whichever of the 2 options above you choose, you will want to obtain an API Key and access token through Mashery and make some sample calls to see how this will work.
API Support Specialist
please help me about to upload multiple contact list
i want to upload a csv file with multiple contacts. Please give me any api activity api code in php
Hi Frank ,
Our PHP SDK does not currently have a method for importing contacts using the multipart form Add Contacts endpoint. You can check out this post in the forum that describes using this endpoint, with some examples, but not in PHP.
The documentation for this endpoint is available here, too.