Hola! ¡Tenemos nuestra Comunidad en Español!

Klipfolio - custom API call for e-mail send statistics

SOLVE
Regular Contributor

We use Klipfolio for dashboarding.

 

It looks like I need to build a custom API call to HubSpot get the data I want - sent, bounce, etc.

 

This link, seems to point to the right endpoint, etc. :

https://developers.hubspot.com/docs/methods/email/get_event_by_id

 

However, how am I supposed to determine the eventID of the email, and the create time in epoch seconds? How can I know or determine that from the HubSpot GUI interface review of the e-mail stats?

 

I'm not finding any clues in the dox.

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Regular Contributor

Finally got it - have to use the campaign endpoint for the summary data, not email events, which provides detail:

 

https://api.hubapi.com/email/public/v1/campaigns/[hubspot internal id from 'see details' in email front end]/?hapikey=[my secret api key]

 

 

Note also, that for an A/B test email, as is the one in question for me right now, it returns details by A variant, B variant, and the 'winner' variant - all 3 distinct pieces of data.

 

But no overall gross summary of the email. i.e. all sends, all dropped, all bounces, etc.

 

If I expect details for the same campaign to excel, I am able to calculate an overall summary in Excel. (And upload that to Klipfolio)

10 Replies
HubSpot Moderator

Hi, @dbhoward.

 

If you're looking to retrieve send, delivery, bounce, open, and click information for an email (campaign) or recipient, then I'd actually recommend this endpoint.

 

While campaignId values can be found in the UI in an email's See details section under Internal HubSpot ID, you won't be able to find create dates and other epoch millisecond timestamps on the front end. Most of the endpoints assume your app is using other endpoints like Get all campaigns and  Get campaign data to retrieve the requisite data.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

So which value is going to be the campaign URL in this UI URL?

 

https://app.hubspot.com/email/2xxxxxx/details/7yyyyyyyyy/performance

 

 

the 'y' value?

Reply
0 Upvotes
HubSpot Moderator

Hey, @dbhoward.

 

Neither. Per my last message, the campaignId is located under See detailsInternal HubSpot ID.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

Ok, I got it. didn't follow you. found the campaign id in the 'see details' section of the email stats review page in the UI

Reply
0 Upvotes
Regular Contributor

Klipfolio errors, even when using the correct value for campaign ID, but in a browser, the URL returns:

 

{"hasMore":true,"offset":"xxx","events":[{"appName":"AbBatch","ipAddress":"217.86.118.48","browser":{"name":"Thunderbird 60.6.1","family":"Thunderbird","producer":"Mozilla Foundation","producerUrl":"https://www.mozilla.org/","type":"Email client","url":"https://www.mozilla.org/en-US/thunderbird/","version":["60.6.1"]},"duration":3286,"userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Lightning/6.2.6.1","created":1553793102833,"location":{"country":"GERMANY","state":"bayern","city":"neumarkt in der oberpfalz","latitude":49.2803},"id":"325e1fca-7c19-3c0e-a6e4-b48d7c7393cd","recipient":"admin@pettering.de","sentBy":{"id":"8091e8fc-47a1-4edd-b72a-ebdc2b984e28","created":1553514509688},"smtpId":null,"portalId":2818205,"type":"OPEN","filteredEvent":false,"deviceType":"COMPUTER","appId":20185,"emailCampaignId":71056404,"emailCampaignGroupId":71056402}]}


Which doesn't look like summary data, but detail data. 

Reply
0 Upvotes
Regular Contributor

Finally got it - have to use the campaign endpoint for the summary data, not email events, which provides detail:

 

https://api.hubapi.com/email/public/v1/campaigns/[hubspot internal id from 'see details' in email front end]/?hapikey=[my secret api key]

 

 

Note also, that for an A/B test email, as is the one in question for me right now, it returns details by A variant, B variant, and the 'winner' variant - all 3 distinct pieces of data.

 

But no overall gross summary of the email. i.e. all sends, all dropped, all bounces, etc.

 

If I expect details for the same campaign to excel, I am able to calculate an overall summary in Excel. (And upload that to Klipfolio)

HubSpot Moderator

Hey, @dbhoward.

 

You're absolutely correct. HubSpot considers each distinct send event a "campaign," so an A/B test will comprise three campaigns.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
Regular Contributor

It would be nice if it reported under a single campaign ID an aggregate number.

 

The front-end appears to report some aggregate number - would be useful to pull the same data via the API.

Reply
0 Upvotes
Highlighted
HubSpot Moderator

Thanks, @dbhoward. I'll pass your feedback along.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
HubSpot Moderator

Hey, @dbhoward.

 

We just released a CMS Marketing Email API which has a Get the statistics for a marketing email endpoint. From my understanding, this should include data from all relevant campaigns, so this may be what you're looking for!

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes