There is probably more ways to do this than I am providing here, but here is one way you can do it:
Opt-ins (subscriptions) and opt-outs (unsubscriptions) are different from bounces. Bounces are not list-specific. If an email bounces, the record of the bounce is saved on the contact and not the list.
Let’s say we want to get opt-in/out and bounces after the date 22-08-01
for list with id 1
, We make a GET
call to:
https://{{yourAccountName}}.api-us1.com/api/3/contacts?include=contactLists&filters[updated_after]=2022-08-01
You will get data similar to the below.
The dates for opt-in/opt-out are in the contactLists
array:
-
opt-in/subscribed date is
sdate
-
opt-out/unsubscribed date is
udate
You can quickly get the status
of a contact, under status
:
The status
values are as follows:
0
- Contact UNCONFIRMED
1
- Contact SUBSCRIBED
2
- Contact UNSUBSCRIBED
3
- Contact Email BOUNCED
(In the example below, the status
of the contact shows they are subscribed.
The dates and bounce counts for the contacts will be in the contacts
array:
bounced_hard
bounced_soft
bounced_date
{
"contactLists": [
{
"contact": "55",
"list": "1",
"form": null,
"seriesid": "0",
"sdate": "2022-08-09T09:26:39-05:00",
"udate": "2022-08-09T09:27:14-05:00",
"status": "1",
"responder": "1",
"sync": "0",
"unsubreason": "",
"campaign": null,
"message": null,
"first_name": "John",
"last_name": "Doe",
"ip4Sub": "0",
"sourceid": "3",
"autosyncLog": null,
"ip4_last": "0",
"ip4Unsub": "0",
"created_timestamp": "2022-08-09 09:04:33",
"updated_timestamp": "2022-08-09 09:04:33",
"created_by": "0",
"updated_by": "0",
"unsubscribeAutomation": null,
"links": {...},
"id": "17",
"automation": null
}
],
"scoreValues": [],
"contacts": [
{
"cdate": "2022-08-02T10:44:02-05:00",
"email": "johndoe+test@example.com",
"phone": "555-555-5555",
"firstName": "John",
"lastName": "Doe",
"orgid": "3",
"orgname": "ActiveCampaign",
"segmentio_id": "",
"bounced_hard": "0",
"bounced_soft": "0",
"bounced_date": "0000-00-00",
"ip": "0",
"ua": "",
"hash": "60af92df3fe723jk454005cda0c",
"socialdata_lastcheck": "0000-00-00 00:00:00",
"email_local": "",
"email_domain": "example.com",
"sentcnt": "0",
"rating_tstamp": "0000-00-00",
"gravatar": "0",
"deleted": "0",
"anonymized": "0",
"adate": "2022-08-09T11:15:42-05:00",
"udate": "2022-08-09T09:27:43-05:00",
"edate": "2022-08-09T09:22:16-05:00",
"deleted_at": "0000-00-00 00:00:00",
"created_utc_timestamp": "2022-08-02 10:44:02",
"updated_utc_timestamp": "2022-08-09 09:27:43",
"created_timestamp": "2022-08-02 10:44:02",
"updated_timestamp": "2022-08-09 09:27:43",
"created_by": "0",
"updated_by": "0",
"email_empty": false,
"mpp_tracking": "0",
"scoreValues": [],
"accountContacts": [
"5"
],
"contactLists": [
"17",
"20"
],
"links": {...},
"id": "55",
"organization": "3"
}
],
"meta": {
"page_input": {
"segmentid": 0,
"formid": 0,
"listid": 0,
"tagid": 0,
"limit": 20,
"offset": 0,
"search": null,
"sort": null,
"seriesid": 0,
"waitid": 0,
"status": -1,
"forceQuery": 0,
"cacheid": "c97afa044754j3458ffa3f5f173"
},
"total": "1",
"sortable": true
}
}