APIs & Integrations

alex5c
Member

Email API: create new email from template

The goal
We have a large database of properties and we send lots of marketing emails about them through hubspot. We would like to automate part of this process since 70% if the info in the email is already in our database. Thus we would like to build a small app that lets us select one of our hubspot email templates and one of the properties from our database and fill in the blanks and saves the draft in hubspot so the marketing team and finish the email and send it from hubspot.

API?
I've looked through the API and I don't see anyway to create a new email with the API. Everything under "Email API" only seems to care about subscriptions and "Email Events API" only comes into play after a email is sent. Are there API endpoints for creating a new email and saving the draft in hubspot?

Thanks!

3 Replies 3
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Email API: create new email from template

Hi @Alex_Smith,

There isn't currently an 'Email API' in the sense you're referring to. Batch/automated emails must be scheduled and sent via the HubSpot UI. The only existing method for programmatically sending emails and populating them with values from an external database would be the Transactional Email API:

0 Upvotes
EyalSegal
Participant

Email API: create new email from template

@Derek_Gervais 
Hi Derek,

 

What about using an existing email, and inject there cistume variables?

 

For example, let's assume a templte like:
"Dear {user},

This week, you had {amount} of {type_of_information} and {other_amount} of {other_type_of_information}

 

Best Regards,

..."

 

And http request like: 

(put): /hubspot/api/.../email

body: {

"template_id": ....

data: {

"amount": 3, 
"type_of_information": "scans"

}

 

Do you know a solution like this?

 

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Email API: create new email from template

Hey @EyalSegal ,

 

That's definitely possible via the Transactional Email API, but it's not possible out-of-the-box with a "normal" HubSpot subscription. The only way to automatically send emails without the Transactional Email add on is via a workflow.

0 Upvotes