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.

How can I get a list of all unsubscribed contacts from the previous day?

Highlighted
Occasional Contributor

How can I get a list of all unsubscribed contacts from the previous day?

How can I get a list of all unsubscribed contacts from the previous day using the API?

I am using the php SDK.

I want to run a daily cron job that pulls the full list of unsubscribed contacts from the previous day.

Any help is appreciated!

1 REPLY 1
Highlighted
Honored Contributor

Re: How can I get a list of all unsubscribed contacts from the previous day?

Hello,

 

The best way to solve this problem is to combine two of the query parameters available on the ContactService.getContacts method. Here's what the usage would look like:

 

$results = $contactServiceObject.getContacts($accessToken, array("status" => "OPTOUT", "modified_since" => "2016-04-26T20:10:06Z"));

 

the parameters that we are passing in are the desired status (OPTOUT) and an additional parameter that filters it to only contacts that have been modified since the given date. It is theoretically possible that there could be other modifications (such as a name change) to an opted out contact, but they would be very uncommon and should not hurt your process as it will still only report on opted out contacts. This will catch any contacts who have recently opted out, as any changes to list memberships will update the modified date of a contact.

 

Let me know if you have any questions!

 

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