brevo-node icon indicating copy to clipboard operation
brevo-node copied to clipboard

SendSmtpEMail constructor not getting sender

Open loyos opened this issue 2 years ago • 2 comments

I tried it just as showed in the guide and got this error --> { code: 'missing_parameter', message: 'sender is missing' },

Here an extract of the code snippet

var sendSmtpEmail = new Brevo.SendSmtpEmail({
    subject: 'Hello from the Node SDK!',
    sender: { email: '[email protected]', name: 'Sendinblue' },
    replyTo: { email: '[email protected]', name: 'Sendinblue' },
    to: [{ name: 'John Doe', email: '[email protected]' }],
    htmlContent:
        '<html><body><h1>This is a transactional email {{params.bodyMessage}}</h1></body></html>',
    params: { bodyMessage: 'Made just for you!' },
}); // SendSmtpEmail | Values to send a transactional email

loyos avatar Sep 03 '23 10:09 loyos

I am also experiencing the same issue

VincentJouanne avatar Sep 11 '23 14:09 VincentJouanne

I think they expect a sender id? from their documentation

curl --request POST \
     --url https://api.brevo.com/v3/smtp/email \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "sender": {
    "name": "Mary from MyShop",
    "email": "[email protected]",
    "id": 2
  },
  "to": [
    {
      "email": "[email protected]",
      "name": "Jimmy"
    }
  ],
  "bcc": [
    {
      "email": "[email protected]",
      "name": "Helen"
    }
  ],
  "cc": [
    {
      "email": "[email protected]",
      "name": "Ann"
    }
  ],
  "htmlContent": "<!DOCTYPE html> <html> <body> <h1>Confirm you email</h1> <p>Please confirm your email address by clicking on the link below</p> </body> </html>",
  "textContent": "Please confirm your email address by clicking on the link https://text.domain.com",
  "subject": "Login Email confirmation",
  "replyTo": {
    "email": "[email protected]",
    "name": "Ann"
  },
  "attachment": [
    {
      "url": "https://attachment.domain.com/myAttachmentFromUrl.jpg",
      "content": "b3JkZXIucGRm",
      "name": "myAttachment.png"
    }
  ],
  "headers": {
    "sender.ip": "1.2.3.4",
    "X-Mailin-custom": "some_custom_header",
    "idempotencyKey": "abc-123"
  },
  "templateId": 2,
  "params": {
    "FNAME": "Joe",
    "LNAME": "Doe"
  },
  "messageVersions": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "Jimmy"
        }
      ],
      "params": {
        "FNAME": "Joe",
        "LNAME": "Doe"
      },
      "bcc": [
        {
          "email": "[email protected]",
          "name": "Helen"
        }
      ],
      "cc": [
        {
          "email": "[email protected]",
          "name": "Ann"
        }
      ],
      "replyTo": {
        "email": "[email protected]",
        "name": "Ann"
      },
      "subject": "Login Email confirmation"
    }
  ],
  "tags": [
    "tag1"
  ],
  "scheduledAt": "2022-04-05T12:30:00+02:00",
  "batchId": "5c6cfa04-eed9-42c2-8b5c-6d470d978e9d"
}

While the part related to Node.js shows no id property used in the sender object.

JefferyHus avatar Nov 29 '23 17:11 JefferyHus