mailjet / mailjet-apiv3-nodejs

[API v3] Official Mailjet API v3 NodeJS wrapper
https://dev.mailjet.com
MIT License
236 stars 69 forks source link

Issue when trying to send variables for template language v3.1 #43

Closed nemanjapetrovic closed 7 years ago

nemanjapetrovic commented 7 years ago

Hi guys,

I have an issue sending template variables with v3.1 API:

So here it is: I have template stored on your website with button HTML like:

<center>
    <a href="{{ var:userVerificationLink:"www.google.com" }}" class="btn-verify">
       Verify Address
    </a>
</center>

And I am sending API (v3.1, nodejs, npm:"node-mailjet": "3.2.1") request like this one:

"Messages ": [{
    "From ": {
        "Email ": "example@example.com",
        "Name ": "Some name"
    },
    "To": [{
        "Email ": "second@second.com",
        "Name ": "Some second"
    }],
    "TemplateID ": 1,
    "Variables": {
        "userVerificationLink": "http://localhost:8080/verify"
    }
}]

And my button in received HTML doesn't have at all href link, is there something else to add to this API call or?

eboisgon commented 7 years ago

Hello Nemanjapetrovic,

In your message, you seem to be missing the following "TemplateLanguage": true, This will indicate to the API that you want the template language to be processed. By default the processing is turned off.

You can check here for more information

Hope it helps

nemanjapetrovic commented 7 years ago

@eboisgon

Yap, that was the problem. Thank you!