We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

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

LoansCanada
Occasional Participant

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
Elijah_G
Member

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