I have a question. We use API /content/api/v2/templates to push marketing emails to Hubspot. And when constructing the email, We replace some content with tokens to load personalized content. We inject the token using {{ personalization_token(‘${hubObjectType}.${p13nToken}’, ‘${originalText.replace(/\n/g, ‘<br>’).replace(/([’"])/g, ‘\\$1’).trim()}‘)’) }}, so that the originalText will display when the token isn’t available. But it seems HubSpot can’t correctly recognize the token when originalText contains single quotes (‘) or double quotes (’'). We’ve tried some escape methods (e.g., using HTML codes for ‘ and ", javascript string replacement), but none work in all cases. Is there a reliable way to safely escape single quotes and double quotes for this case? Thank you.
Hi @YQin, I hope that you are well!
Thanks for asking the Community!
I’d like to invite a couple of subject matter experts to this conversation: Hi @Indra, @Syeda_Fatima and @stefen do you have suggestions to help @YQin, please?
Thanks so much and have a great day!
Best,
Bérangère
Hi @Indra@stefen and others, wondering if you have any tips here?
Basically, we cannot include an apostrophe or quotation marks in the default value for personalization_token when pushing the source content using the `/content/api/v2/templates` endpoint.
It seems there should be a way to escape these characters.