Email endpoint returns data for some recipients, but not others


#1

I have a list of recipients for a particular campaign. I believe all of them have at least received one email.

Using python and the email events endpoint, I am testing retrieving email event data for the recipients as follows:

Python code:

#...various import statements...

url='https://api.hubapi.com/contacts/v1/contact/email/[recipient email 123]/profile?hapikey=[my api key]'

f = urllib.request.urlopen(url2)
print(f.read().decode('utf-8'))

I am finding that although both [recipient email 123] and [recipient email 456] are in the same campaign recipient list, email recipient will return data while recipient 456 will not. Any clue why that would be? As a new hubspot user, I would expect that qualifying only on the recipient email would return data across all the campaigns that have touched them.

My ultimate goal is to return the list of recipients from the email endpoint by qualifying on the campaignid parameter, but until I can solve the above I won't feel confident that I'm catching all the campaign recipients.

Thanks for any advice!


#3

Hi @ouonomos, happy to help. Taking a look at your request URL, that looks like the search for a contact by email endpoint, not the email events endpoint: https://developers.hubspot.com/docs/methods/email/get_events. Could this be the source of your issue?

If not, can you please respond here with an example URL that you're using with a proper contact email address (exclude api key), and your HubID?


#4

Apologies -- you're right; I'd copied that email address into the wrong URL example
However, I still don't return anything when using the email endpoints URL:
url3='http://api.hubapi.com/email/public/v1/events?hapikey=[myapikey]&recipient=nwnippy27+cb1@gmail.com'

... returns

{"hasMore":false,"offset":"CgoY__________9_","events":[]}

By contrast,
url3='http://api.hubapi.com/email/public/v1/events?hapikey=[myapikey]&recipient=guy.golan@redfin.com'

Does return data.


#5

Hi @ouonomos, it appears you can't make this request for emails with a + character in them. URL encoding doesn't seem to work either. I'm going to reach out to see if this is expected but I do believe it is. Further, make sure to make your requests to the the secure URL rather than http, though that shouldn't have had a bearing on what you saw with the first example you wrote above.


#6

Thanks so much Connor! I'll implement your fixes.