1

We would like to use custom token in URL in EXM email enter image description here

We are sending this email through EXM clientAPI

var customTokens = new Dictionary<string, object>();
customTokens.Add($"contactId", contact.Id);
AutomatedMessage automatedMessage = new AutomatedMessage()
{
                   ContactIdentifier = contact.Identifiers.FirstOrDefault(),
                                    MessageId = messageId,
                                    CustomTokens = customTokens
};
automatedMessageBus.Send(automatedMessage);

Above code is sending email but link which is added in EXM is converting into below code and not passing the contactId custom token value when we click on it.

https://hostname.com/sitecore%20modules/Web/EXM/RedirectUrlPage.aspx?ec_eq=rN44vKX49RHdqFvhTcbo97J8Hxy4RpN2FEI0CMHbX9wsf1K50cGBaGUMbr0%2bqGcVhTgw2fJovuZaHWAq1BVMCl%2fNaTfF3KJVOtXTqkYvRtuclqVTql21NSTNeJdHXchgB4zkot1gyAuUtU7IeYuvnGEU00J6EgIIUGtTEEoyS8w89jZ%2b6Fd7jbW2mS5HIuHlra5hj5TkG7BkpdAQSkfW6d17dHPy3WISVMBVTsAIRuVOtJsWtCxwBKNaP5IiRT1j0zd5OyMDXwnCjl%2bec0hnDK0Cf7swcBzBPOA8MJR7gQTepGmCHm7naka9ptxifgu6CC%2f0itgjipEdZR24zD6NgA%2f%2frVP402Q%2fc1IZ7s%2bzXBTOln8E4xJPTZZnBCFO%2f6R3ZxYoYeBwLR0WpUqcJeEUJ1lKA%2bSc7dV76mzFjlC5sSc%3d

When we click on above link then it is showing on browser link this :

https://hostname.com/thankyoupage?contactId=$contactId$

When we use $contactId$ without adding in URL then we get custom token value.

4
  • Can you take a look at the post sitecore.stackexchange.com/questions/17739/…, seems to be related to your question. – Cristi Vulturar Apr 13 at 11:32
  • Thank you for sharing the link. However, it does not relate to my question. – User7864 Apr 13 at 12:44
  • @SitecoreMember did you check if the custom token is working if used without URL, I mean try using something dear $contactId$ and see if the token is getting resolved? – Raman Gupta Apr 14 at 3:23
  • @RamanGupta yes, custom token is replaced with value if I use without url in email body. – User7864 Apr 14 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.