APIs & Integrations

Not applicable

Looping and conditions in email

SOLVE

Marketing dept at my company wants our system to send out an "order confirmation" email listing the products that were purchased as well as transaction details (coupon values applied, taxes, subtotals, totals, etc). Some transaction details will only be displayed in some emails where applicable.

Currently the system generates the content (HTML) of the email and it is just sent via SendGrid's SMTP (without using their templating system). Marketing wants to take control of the content via Hubspot and just have the system supply the data for the products and have Hubspot generate the content for the email so that Marketing can manipulate the look of the email without needing IT. This means that the template/email that Marketing creates need to support "looping" (to be able to get information about each product and generate the content for the product) as well as being able to hide content based on certain conditions.

How can this be accomplished in Hubspot email templates?

2 Accepted solutions
Solution
Not applicable

Looping and conditions in email

SOLVE

Hi @Connor_Barley, thanks for the response.

We are using the Single Send API to send values to the email. The "Purchase Receipt" use case example under the Single Send API section of the Transactional Email API link you sent is what we are trying to accomplish. However I also saw the note under the Custom Properties section of the Single Send API link that states

Note: Custom properties do not currently support arrays. To provide a listing in an email, one workaround is to build an HTML list (either with tables or ul) and specify it as a custom property.

It seems to me that any company sending a receipt email would want to include at least some product details in the email which is really not currently possible since custom properties don't support arrays. We are already implementing a feature to send HTML via the API but this is not the best solution from Marketing's perspective because anytime they need to change the layout of the product information, they need to wait on IT to make the change to the HTML that is being sent via the API rather than being able to edit the email in Hubspot themselves without having to wait on IT.

Since this is something Hubspot has identified as a common use case, when will the ability to loop through arrays of custom properties and conditionally hide and display sections of an email be available?

View solution in original post

IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Looping and conditions in email

SOLVE

Hi, @mstanwyck.

 

Sincere apologies for the delayed response. @cbarley is no longer with HubSpot and now has a new Community user, @cbarley10.

 

Yes, adding conditional and looping HubL support to Hubspot emails is a priority for the team. That said, they are not yet at a stage where we can offer definitive dates.

 

If you haven't already, I recommend subscribing to the Developer Changelog so that you are notified once this functionality becomes publicly available.

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
12 Replies 12
Shane_Janssens
HubSpot Product Team
HubSpot Product Team

Looping and conditions in email

SOLVE

Hi There,

We now support looping in marketing email for Pro+ users with our new programmable email feature. You can take a look at the knowledge base article HERE.

Best,

 

Shane

 

derekperkins
Participant

Looping and conditions in email

SOLVE
Mar 6, 2020

Yes, adding conditional and looping HubL support to Hubspot emails is a priority for the team. That said, they are not yet at a stage where we can offer definitive dates.

 

Jan 21, 2021

B:  It is getting close.  I cannot provide an exact timeline, but it is definitely being worked on.


The timeline doesn't match up with the supposed priority of this fairly core feature. This doesn't feel like a multi-year lift when there's already a templating language that supports arrays.

0 Upvotes
jchenault
Member

Looping and conditions in email

SOLVE

Checking in on this as well. We've recently moved from Mandrill and it's a bit of a make-or-break feature. We can certainly build HTML before we send it over but it is not at all ideal.

Phm
Participant

Looping and conditions in email

SOLVE

What's the status of this? it's been in the developers "priority for more than 2 years."

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Looping and conditions in email

SOLVE

Hey @Phm 

A: Welcome to the Community!

B:  It is getting close.  I cannot provide an exact timeline, but it is definitely being worked on. 

vicente_canhoto
Member

Looping and conditions in email

SOLVE

Hi @Connor_Barley, I stumbled upon this thread when searching for a solution for a similar problem. In my case we want to have invoice-related data in our transactional emails, but without support for arrays in the Custom properties and conditional statements we have to generate chunks of the emails on our side before passing them on to Hubspot, which is terribly inefficient, and in a way it's making us reconsider the use of the transactional email altogether. It would be a great improvement to have this fixed in the near future.

cbarley
HubSpot Alumni
HubSpot Alumni

Looping and conditions in email

SOLVE

Hi @vicente.canhoto, thanks for responding here! I'll add your use case to our internal feedback tool. I'd also recommend posting this idea in our public Ideas forum here: https://community.hubspot.com/t5/custom/page/page-id/ideaslandingpage

0 Upvotes
mstanwyck
Participant

Looping and conditions in email

SOLVE
So this is over a year old and I'm checking in on any progress here.
 
We just bought into the transactional email platform and moved away from Sendgrid. Not having this is, at the risk of sounding hyperbolic, almost inexcusable.
 
This would be like one of the very first things you’d want for any type of templating system.
It makes our work with your transactional emails very messy and cumbersome.
 
Is there anything that's actually being done in this area? Not "it's in future plans" kind of scenario. Rather something we can expect in order to make our move to use the transactional platform effective.
 
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Looping and conditions in email

SOLVE

Hi, @mstanwyck.

 

Sincere apologies for the delayed response. @cbarley is no longer with HubSpot and now has a new Community user, @cbarley10.

 

Yes, adding conditional and looping HubL support to Hubspot emails is a priority for the team. That said, they are not yet at a stage where we can offer definitive dates.

 

If you haven't already, I recommend subscribing to the Developer Changelog so that you are notified once this functionality becomes publicly available.

Isaac Takushi

Associate Certification Manager
0 Upvotes
Solution
Not applicable

Looping and conditions in email

SOLVE

Hi @Connor_Barley, thanks for the response.

We are using the Single Send API to send values to the email. The "Purchase Receipt" use case example under the Single Send API section of the Transactional Email API link you sent is what we are trying to accomplish. However I also saw the note under the Custom Properties section of the Single Send API link that states

Note: Custom properties do not currently support arrays. To provide a listing in an email, one workaround is to build an HTML list (either with tables or ul) and specify it as a custom property.

It seems to me that any company sending a receipt email would want to include at least some product details in the email which is really not currently possible since custom properties don't support arrays. We are already implementing a feature to send HTML via the API but this is not the best solution from Marketing's perspective because anytime they need to change the layout of the product information, they need to wait on IT to make the change to the HTML that is being sent via the API rather than being able to edit the email in Hubspot themselves without having to wait on IT.

Since this is something Hubspot has identified as a common use case, when will the ability to loop through arrays of custom properties and conditionally hide and display sections of an email be available?

cbarley
HubSpot Alumni
HubSpot Alumni

Looping and conditions in email

SOLVE

Hi @idimensionz, I don't have a timeline for that functionality, but would be happy to send your feedback to our developers internally.

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

Looping and conditions in email

SOLVE

Hi @idimensionz, this can't be accomplished out of the box with HubSpot, but the Transactional Email API, and specifically the Single Send API can send an email after a purchase using our templates as well as custom properties from your external system along with HubSpot personalization tokens. Conditional statements using HubL cannot be used in the Marketing Email tool, as list segmentation and workflow automation handles most of the use cases for these scenarios.

0 Upvotes