sendinblue / APIv3-nodejs-library

SendinBlue's API v3 Node.js Library
ISC License
101 stars 47 forks source link

sendTemplate attributes don't appear to work #44

Closed rendermusic closed 5 years ago

rendermusic commented 5 years ago

sendTransacEmail with the 'params' key works fine. However, using sendTemplate with 'attributes' leaves {{ }} tokens blank in the final email.

Tried: {{ attributes.attributeName }}, {{ params.attributeName }}, {{ attributeName }} and all are left blank.

palmthree-studio commented 5 years ago

Did you try to this = "{ attributes.attributeName }, { params.attributeName }, { attributeName }" instead this "{{ attributes.attributeName }}, {{ params.attributeName }}, {{ attributeName }" ?

ekta-slit commented 5 years ago

Hi @rendermusic

The API call Send a transactional email is used to send SendinBlue’s New Template Language Templates (which uses for ex {{ params.parameterNAME }} for params replacement), please refer our help doc Wrapper link: https://developers.sendinblue.com/reference#sendtransacemail - https://github.com/sendinblue/APIv3-nodejs-library/blob/master/docs/SMTPApi.md#sendTransacEmail

Now the another API call Send a template which also says This endpoint is deprecated. Prefer v3/smtp/email instead. is used to send SendinBlue’s Old Template Language Templates (which uses for ex %ORDER_AMOUNT% for attributes replacement), again please refer our help doc Wrapper link: https://developers.sendinblue.com/reference#sendtemplate-1 - https://github.com/sendinblue/APIv3-nodejs-library/blob/master/docs/SMTPApi.md#sendTemplate

Thanks

Pimonus commented 5 years ago

same issue for me, here is my code:

const defaultClient = SibApiV3Sdk.ApiClient.instance;
const apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = config.SENDINBLUE.apiKey;
const apiInstance = new SibApiV3Sdk.SMTPApi();

await apiInstance.sendTemplate(myTemplateId, {
    emailTo: [myEmail],
    params: {
      foo: 'bar',
    },
  });

here is my template: Value of foo: #{{ params.foo }}# Value of mail: #{{ contact.EMAIL }}#

here is the mail I receive:

Value of foo: ## Value of mail: #myEmail#

I'm a bit confused, I don't know what I'm doing wrong :/ Thx for your answer

matejicekme commented 4 years ago

Same problem here, Up !

gabriel-castro commented 4 years ago

was this fixed? I have same problem