How to retrieve all imported e-mail addresses?

SOLVE
Highlighted
New Contributor

I understand that there is no api equivalent for the 'Export unsubscribes and bounces' (yet) and that the alternative way is to get all contacts and then use the get_status method for each contact.  But I noticed that email addresses that were imported via the 'Import opt-out list' feature are not considered a contatc and therefore not included in Get all contacts.

Is there API-way to retrieve such non-contact e-mail addresses?

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Employee

Hi @franknesse,

 

One way to do this would be to use the"View subscriptions timeline for a portal" endpoint. This will return a time-ordered list of subscription changes. Emails included as an opt out list will show here aswell. The payload will typically contain an array of objects signifying the subscription event. 

 

        {
            "portalId": 2990812,
            "recipient": "coldrickjackhubspot2020@gmail.com",
            "changes": [
                {
                    "change": "UNSUBSCRIBED",
                    "source": "SOURCE_IMPORT",
                    "portalId": 2990812,
                    "causedByEvent": {
                        "id": "db38e08e-b9de-496d-a15a-2b1aeeb06895",
                        "created": 1575306951484
                    },
                    "changeType": "PORTAL_STATUS",
                    "timestamp": 1575306951484
                }
            ],
            "normalizedEmailId": "b8bb79c4-838c-44ec-a4af-6b8c635e1c83",
            "timestamp": 1575306951484
        }

In the above example the email coldrickjackhubspot2020@gmail.com was imported via opt out list. This is further denoted by the source parameter:

 

"source": "SOURCE_IMPORT"

You can also use the option parameter "changeType=X" to return specified types of changes. For example a request like the below will return all subscription events whereby an individual was either SUBSCRIBED or UBSUBSCRIBED.

 

https://api.hubapi.com/email/public/v1/subscriptions/timeline?hapikey={{apikey}}&changeType=PORTAL_STATUS

 

So if you put all of that together you can use the "View Subscription Timeline for a portal" to get a time ordered list of subscription changes. You can specifically get the SUBSCRIBE and UNSUBSCRIBE events using the optional parameter "changeType=PORTAL_STATUS" and then use the "source" to understand if it was the result of an opt out list being imported.

 

I hope this is of some help!

 

Regards,

Jack

 

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
2 Replies 2
HubSpot Employee

Hi @franknesse,

 

One way to do this would be to use the"View subscriptions timeline for a portal" endpoint. This will return a time-ordered list of subscription changes. Emails included as an opt out list will show here aswell. The payload will typically contain an array of objects signifying the subscription event. 

 

        {
            "portalId": 2990812,
            "recipient": "coldrickjackhubspot2020@gmail.com",
            "changes": [
                {
                    "change": "UNSUBSCRIBED",
                    "source": "SOURCE_IMPORT",
                    "portalId": 2990812,
                    "causedByEvent": {
                        "id": "db38e08e-b9de-496d-a15a-2b1aeeb06895",
                        "created": 1575306951484
                    },
                    "changeType": "PORTAL_STATUS",
                    "timestamp": 1575306951484
                }
            ],
            "normalizedEmailId": "b8bb79c4-838c-44ec-a4af-6b8c635e1c83",
            "timestamp": 1575306951484
        }

In the above example the email coldrickjackhubspot2020@gmail.com was imported via opt out list. This is further denoted by the source parameter:

 

"source": "SOURCE_IMPORT"

You can also use the option parameter "changeType=X" to return specified types of changes. For example a request like the below will return all subscription events whereby an individual was either SUBSCRIBED or UBSUBSCRIBED.

 

https://api.hubapi.com/email/public/v1/subscriptions/timeline?hapikey={{apikey}}&changeType=PORTAL_STATUS

 

So if you put all of that together you can use the "View Subscription Timeline for a portal" to get a time ordered list of subscription changes. You can specifically get the SUBSCRIBE and UNSUBSCRIBE events using the optional parameter "changeType=PORTAL_STATUS" and then use the "source" to understand if it was the result of an opt out list being imported.

 

I hope this is of some help!

 

Regards,

Jack

 

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
New Contributor

Thanks @jackcoldrick , this looks like what I need. 

Reply
0 Upvotes