APIs & Integrations

akeller84
Member

What is the appId associated with an email sent by a workflow

SOLVE

Hello,

 

We have an application that generates a report of stats for emails sent by a workflow. The report gets all the opens/clicks/etc. and groups all the stats by recipient.

 

Our current process goes like this:

1. Get all data about a specific workflow using the following endpoint:

https://developers.hubspot.com/docs/methods/workflows/v3/get_workflow

 

2. Loop over the 'actions' array and store all the emailCampaignId values in a temporary variable

 

3. Then we call the following endpoint for each emailCampaignId we store from the previous step. We only use the emailCampaignId in each call.

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

 

4. Finally we process the response to generate the data we need

 

This procedure has been working fine for us whenever we wanted a report for a workflow that sent emails in the past. However, we just came across an issue where the email events api was returning the following error: "query params 'appId' and 'emailCampaignId' must be specified together". It seems like this error occurs whenever we query using an emailCampaignId for an email that hasn't been sent  yet.

 

I'm trying to understand why this error doesn't occur when a campaign has already been sent by a workflow. Other resources I found also say that the emailCampaignId and appId should be sent together (for example: https://developers.hubspot.com/docs/methods/email/email_events_overview), but why didn't the endpoint return an error before?

 

My other issue (and main question) is that I don't know where to get the appId that the error is complaining about. I found this resource:

https://developers.hubspot.com/docs/faq/how-do-i-find-the-app-id

But this seems to be about apps created in the developer account. I found other posts in this forum but they are also talking about apps in the developer account. The emails are sent by a workflow so they are not associated with an app.

 

I did notice that all the events in the email events api are returning an appId of 2286 but I can't find that documented anywhere.

 

Where can I get this appId?

 

Thank you.

0 Upvotes
1 Accepted solution
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

What is the appId associated with an email sent by a workflow

SOLVE

Hi @akeller84 , The AppId as explained here is the ID of the app that sent the email. You're right, as the App ID in that article is referring to a HubSpot App's ID, used in OAuth processes. Completely unrelated.

 

We don't have a dictionary of different App Ids for email campaigns, but the best way to do that is make a GET to this endpoint (https://developers.hubspot.com/docs/methods/email/get_campaign_data) before making a GET to the get events endpoint. That way, you'll have the App ID for that campaign already. You could store those values in an array or push them to the same object that the campaign id's are stored in to create sets of key value pairs.

View solution in original post

1 Reply 1
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

What is the appId associated with an email sent by a workflow

SOLVE

Hi @akeller84 , The AppId as explained here is the ID of the app that sent the email. You're right, as the App ID in that article is referring to a HubSpot App's ID, used in OAuth processes. Completely unrelated.

 

We don't have a dictionary of different App Ids for email campaigns, but the best way to do that is make a GET to this endpoint (https://developers.hubspot.com/docs/methods/email/get_campaign_data) before making a GET to the get events endpoint. That way, you'll have the App ID for that campaign already. You could store those values in an array or push them to the same object that the campaign id's are stored in to create sets of key value pairs.