'Sendgrid not populating dynamic data

I have an dynamic email template and set it up to accept data while email is triggered from the code. However I have received complaints that some times the email is not having dynamic data, and therefore the link is broken.

I am adding the template Setup, Code and expected behavior

Expected Behavior:

I expect to get a complete link in the email like below. https://verifyuser.mysite.com/user/verify?q=aWRyZWVzQGFjdW1lbml0eS5jb20= However for few emails (Not reproduceable all the time) users are receiving broken link (with out the encrypted code to verify user), indicating that dynamic variable was not populated. I checked the logs and its been sent with every request.

https://cinch-exam-dashboard-api.herokuapp.com/user/verify

Template Setup:

<div data-lineheight="2.0" style="line-height: 28px;"><strong style="font-size: 14px; color: rgb(44, 160, 28);">
  <a clicktracking=off href="https://verifyuser.mysite.com/user/verify{{verifylink}}"> Verify Account </a>
</strong></div>

Code to send Email With Dynamic Attribute:

   //Template usage
            Personalization personalization = new Personalization();
            personalization.addTo(to);
            personalization.addDynamicTemplateData("verifylink", "?q=aWRyZWVzQGFjdW1lbml0eS5jb20=");


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source