Email Marketing Tool

MSaurat
Contributor

IF Statements in HTML email template

Hi, 

Quite new to HS here. I've been trying to add IF statements in HTML template based on contact owner ID (but will be uself for any other contact property in the future). 

Basically we have different BDM and I want to show different "get in touch with your BDM"

 

Code looks like this: 

 {% if hubspot_owner_id == 123456789 %}
                     show this image and text
                                      {% else %}
                                     show something else 
                                      {% endif %}
 
I've tried looking into modules as well but not sure how to use them in an HTML template. 
 
There must be a way to make this work. We used to have a very simple ESP before and it would work. Surely hubspot can make it happen as well.
3 Replies 3
orgmadnezz
Participant

IF Statements in HTML email template

you need to turn on beta email templates

https://knowledge.hubspot.com/marketing-email/create-programmable-emails
then you need to create modules


and you need to define your variables before start coding your template (see image)

 

orgmadnezz_0-1710436798347.png

 

 

 

 

0 Upvotes
Ben_M
Key Advisor

IF Statements in HTML email template

Is there a reason you are trying to program this into the template? You could just use smart content to look for the owner and display a different section depending on the owner. Just make sure you build some active lists in Hubspot to look at the owner and then use that membership to match it to your content section.

MSaurat
Contributor

IF Statements in HTML email template

Yes because this is section that is recurring and I don't want to update this evertime I send a campaign. 

But also how to create smart content that's not on a drag and drop email? 

0 Upvotes