I am currently sending marketing email information through a webhook, and I am receiving the subject line, the To, and the From. I am trying to send the content of the email, but have been unable to do so. Since I can not send the content, I want to send the Web version URL for the email, and have been told to use
GET - /marketing/v3/emails/{emailId}
I am writing to see if there is a way to make the {emailID} dynamic and pull the marketing email ID of the email sent to a contact, rather than having a single line of code for each email that I create. I have had no luck with this but would love to be able to send the URL back to my system so I can easily view what email has been sent.
Hey @DWild30
Thank you for your question!
I’m gonna tag some subject matter experts from our community who may be able to lend you a hand:
Hey @BrandonWoodruff @SteveHTM @Balaji_Mavlers1 Do you have any tips to help us out here?
Thanks!
Victor
Hey @DWild30 - I’d be happy to take a peek at this but I just want to make sure I understand what we’re working with here:
Can you clarify where the From / To / Subject are coming from, is this a HubSpot marketing email event webhook, or an API/workflow action where you’re sending the email yourself? If possible, can you share which webhook or endpoint you’re using (no payload needed).
Hi @DaganBPM thank you for the response. For additional context, we send all of our emails to contacts through marketing emails, as workflows. We have a separate workflow that is triggered when a “Marketing or sales email sent has been completed any number of times anytime” or “Marketing or sales email delivered has been completed any number of times anytime”. This then sends a webhook to our Point of Sale system, which has a custom request body that has different properties to send, including the From / To / and Subject of the email. We have the email body property selected in this webhook, but we do not receive it. So we are trying to send the URL web version of the email through the GET I mentioned above instead. I hope this helps!
Apologies for the delay, I’ve had some trouble figuring out a method that might work for you here. I think I may have found a very rough workaround, but I also have one more question - how are you referencing the Email Body / Subject / From email in the workflow, is it by email associated with the contact or through some other means?
The very rough workaround:
- Use the legacy GET - /email/public/v1/events?recipient={URI-encoded-recipient-email}&limit=10 to get the last email sent to a contact
- I’d also recommend using the created field to quickly check that the email was sent recently with a new timestamp, don’t just rely on the ordering of the API response
- Get the campaignId from the response
- Use the campaignId to GET - /email/public/v1/campaigns/{campaign_id}
- Get the contentId from the response
- Use the contentId to GET - /marketing/v3/emails/{emailId}
It’ll be heavy on the API calls and relies on 2 legacy endpoints so it’s not ideal but I couldn’t find any other way of reliably getting the email if there’s no way to extract the Body in the workflow! HubSpot’s API’s are awesome, but I think that the Emails endpoints are probably the most lacking in terms of actual functionality.
Sorry for the delay. To answer your question, my understanding is that we are associating the email with the contact via email address once the information comes through the webhook to our Point of Sales system.
I passed this along to my team and they had a concern about the number of requests we would be making. Is there any way we can get a direct endpoint or webhook property for the URL to be sent in what we already use?