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

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.


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


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

  • Can you take a look at the post sitecore.stackexchange.com/questions/17739/…, seems to be related to your question. Apr 13, 2021 at 11:32
  • Thank you for sharing the link. However, it does not relate to my question.
    – User7864
    Apr 13, 2021 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? Apr 14, 2021 at 3:23
  • @RamanGupta yes, custom token is replaced with value if I use without url in email body.
    – User7864
    Apr 14, 2021 at 10:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.