[SalesForce] Guide Template Language to provide dynamic links via href attribute

I'm trying to use the Guide Template Language to provide a dynamic link in a triggered send, something like this:

<a href="{{My_Url}}">{{My Url}}</a>

or

<a href="{{My_Url}}">Your Account</a>

Also tried

<a href="{{My_Url [format=url-param-string]}}">{{My Url}}</a>

Suppose I pass { "My_Url": "http://www.example.com" }

What happens is that the tag in the HTML text is replaced with the provided value, but the href is ignored and therefore leads to a busted link.

Help?

Best Answer

GTL is limited in SFMC. I'd stick with AMPScript.

You can do what you're wanting with AMPScript in an email (triggered or otherwise):

%%[

var @firstName, @link
set @firstName = AttributeValue("firstName")
set @link = AttributeValue("link")

]%%

Hi%%=iif(not empty(@firstName),concat(", ",@firstName),"")=%%.
<br><br>Please, click this <a href="%%=redirectto(@link)=%%" alias="link">link</a>.

The firstName and link attributes don't have to have matching Profile Attributes or a columns in a Triggered Send templated Data Extension (it is a good practice, however). As long as you are passing them in the payload of your API call, you'll have access to them in the email.

There are a few more details in my answer on this question:

How do I pass data to an email via a triggered send?

Related Topic