Fetching contact's email conversations via API

Requirement is, when contact’s ID is given fetch all the emails sent and received by the perticular client.

Fetching sent emails is an easy task with the engagement API + hs_email_to_email == “contact’s email” filter.

Issue is getting the received emails. In the received emails both hs_email_sender_email and hs_email_to_email is same. Therefore cannot identify the sender of the email. Workaround is to fetch all the emails and do an another query for email to get the assosicated contact ID. This method is not very efficient so I’m wondering if there is any another way to list out the emails for a selected contact

Hi, @CSamarakoon :waving_hand: Thanks for your question.

I believe you are correct in your analysis. You’ve touched on a limitation of the HubSpot APIs. Namely, that there might not be a straightforward way to efficiently fetch only the received emails for a contact without additional processing.

One random thought – Does your system have knowledge of the email addresses used by your organization? You may be able to programmatically detect if an email is received by checking if the hs_email_sender_email is not one of your organization’s email addresses.

While you’ll likely need to utilize multiple calls, hopefully someone from our community has a more efficient or different approach to what you are needing to do.

Best,

Jaycee

Hello,

I am observing the same issue for received emails: the hs_email_sender_email is not the email address of the person out of my organization that sends us the email but instead the email address of the receiver.

Could you please fix it ?

For information, this is the endpoint that I am requesting:

"/crm/v3/objects/emails/batch/read"

Best,

Clément