CMS Development

patrickll
Membro

Using embed code in personalization tokens to share content in an email template

resolver

I am trying to send video feedback to customers within an email template. I have embed code stored in personalization tokens that is updated weekly on an external database, then the property for that contact is updated.

 

The embed code will display correctly when it is pasted directly into the template, like this:

 

									<tr>
															<td class="pad" style="padding-top:21px;padding-bottom:21px;">
																<div align="center"><iframe src="https://grain.com/_/embed/highlight/QG5cHwwwYIATZIo5ClSOiC5M9IU6kg6bqdT7g22D?show_engagement=true&autoplay=false&origin=user_iframe" height="364" width="576" allow="fullscreen" allowfullscreen="true" frameborder="0"></iframe></div>
															</td>
														</tr>

 

Screen Shot 2022-08-02 at 21.53.07.png

 

However, when I try to fetch the embed code from a property using a personalization token, it does not show, instead it shows the embed code itself.

 

 

	<tr>
															<td class="pad" style="padding-top:21px;padding-bottom:21px;">
																<div align="center">{{ personalization_token('contact.teacher_video') }}</div>
															</td>
														</tr>

 

 

Screen Shot 2022-08-02 at 21.48.04.png

 

I think I am missing something in the formatting, and I am not very knowledgeable in code, so was directed to this forum by Hubspot support. Any help would be greatly appreciated.

0 Avaliação positiva
1 Solução aceita
BarryGrennan
Solução
Top colaborador(a)

Using embed code in personalization tokens to share content in an email template

resolver

I'm not an expert in encoding but what's almost certainly happenig is the personalization token is being encoded as text rather than html

 

so rather than 

 

 

<iframe src="https://grain.com/_/embed/highlight/QG5cHwwwYIATZIo5ClSOiC5M9IU6kg6bqdT7g22D?show_engagement=true&autoplay=false&origin=user_iframe" height="364" width="576" allow="fullscreen" allowfullscreen="true" frameborder="0"></iframe>

 

 

it's rendering as 

 

 

&lt;iframe src="https://grain.com/_/embed/highlight/QG5cHwwwYIATZIo5ClSOiC5M9IU6kg6bqdT7g22D?show_engagement=true&amp;autoplay=false&amp;origin=user_iframe" height="364" width="576" allow="fullscreen" allowfullscreen="true" frameborder="0"&gt;&lt;/iframe&gt;

 

 

 

You'll see the same happen if you paste your iframe directly into a richtext field.

 

I wonder if thers some filter you could use, maybe something like:

 

 

{{ personalization_token('contact.teacher_video')|urldecode }}

 

I'm not sure though, try it out and have a look arround the filters if that doesn't work, maybe try some others

https://developers.hubspot.com/docs/cms/hubl/filters

 

Worst case, I'd say you could use a split|first|last method as in this thread to pull the url out of the personalization token. It can be a little tough to work out the split exactly, but I imagine you can achieve it that way.

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact

 

 

 

Exibir solução no post original

4 Respostas 4
BarryGrennan
Top colaborador(a)

Using embed code in personalization tokens to share content in an email template

resolver

I'm not in front of my computer at the moment but this feels like the visual editor for email is rendering what you've entered as text.

 

One workaround might be storing the url of the video as a personalization token instead of trying to put the whole iframe in there.

 

Then in the code of your email you'd put something like:

<div><iframe src="{personalization_token('contact.video_url')}"></div>

 

I haven't included the rest of your iframe perimeters there because writing code on a phone is hard 😅. For that same reason, double check the code I gave for typos.

But hopefully you get what I'm suggesting

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact

 

 

0 Avaliação positiva
patrickll
Membro

Using embed code in personalization tokens to share content in an email template

resolver

Unfortunately, the property has to be stored with the <iframe> code, as this is how it is taken from the database it is connected to. Separating the video link would require manually editing every property, as it's the embed link that is stored on the database. For context, the videos are embedded on our own platform - we want it to be emailed to customers as well.

 

I'm not sure why it cannot be accepted as code instead of a text string. It might be something to do with the property itself. I am not finding any examples online of properties containing code, so you might be onto something.

0 Avaliação positiva
BarryGrennan
Solução
Top colaborador(a)

Using embed code in personalization tokens to share content in an email template

resolver

I'm not an expert in encoding but what's almost certainly happenig is the personalization token is being encoded as text rather than html

 

so rather than 

 

 

<iframe src="https://grain.com/_/embed/highlight/QG5cHwwwYIATZIo5ClSOiC5M9IU6kg6bqdT7g22D?show_engagement=true&autoplay=false&origin=user_iframe" height="364" width="576" allow="fullscreen" allowfullscreen="true" frameborder="0"></iframe>

 

 

it's rendering as 

 

 

&lt;iframe src="https://grain.com/_/embed/highlight/QG5cHwwwYIATZIo5ClSOiC5M9IU6kg6bqdT7g22D?show_engagement=true&amp;autoplay=false&amp;origin=user_iframe" height="364" width="576" allow="fullscreen" allowfullscreen="true" frameborder="0"&gt;&lt;/iframe&gt;

 

 

 

You'll see the same happen if you paste your iframe directly into a richtext field.

 

I wonder if thers some filter you could use, maybe something like:

 

 

{{ personalization_token('contact.teacher_video')|urldecode }}

 

I'm not sure though, try it out and have a look arround the filters if that doesn't work, maybe try some others

https://developers.hubspot.com/docs/cms/hubl/filters

 

Worst case, I'd say you could use a split|first|last method as in this thread to pull the url out of the personalization token. It can be a little tough to work out the split exactly, but I imagine you can achieve it that way.

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact

 

 

 

Jaycee_Lewis
Gerente da Comunidade
Gerente da Comunidade

Using embed code in personalization tokens to share content in an email template

resolver

Hi, @patrickll 👋 Welcome to the community! Hey, @Anton @pixl_labs @BarryGrennan do you have any insight or suggestions for @patrickll?

 

Thank you for taking a look!  — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot