3.4.3 • Published 6 months ago

@auronet/sendinblue-simple-client v3.4.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

SendinBlue Simplified Client

To install you only need to:

yarn add sendinblue-simple-client

Example of usage:

import ClientSendingBlue, { EmailUser } from 'sendinblue-simple-client';

const mySecretApiKey = process.env.API_KEY;

async function main() {
  const emailClient: ClientSendingBlue = new ClientSendingBlue(mySecretApiKey);

  const sender: EmailUser = {
    name: 'dotnotreply',
    email: 'dotnotreply@mydomain.com.br',
  };

  const destination: EmailUser = {
    name: 'John',
    email: 'john@doe.com',
  };

  const content = await emailClient.templatesProvider(3);
  if (content) {
    try {
      const responseOfContent = await emailClient.sendEmail({
        sender: sender,
        to: [destination],
        subject: '[SUBJECT-here] MY Subject',
        content: content,
        contentParams: {
          name: 'John Doe',
          someOtherParam: '123123',
        },
      });

      // or send using a template Id
      const responseOfsendByTemplateId =
        await emailClient.sendEmailWithTemplateById({
          sender: sender,
          to: [destination],
          subject: '[SUBJECT-here] MY Subject',
          contentParams: {
            name: 'John Doe',
            someOtherParam: '123123',
          },
          templateId: 1,
        });

      console.log({ responseOfContent, responseOfsendByTemplateId });
    } catch (error) {
      console.log(error);
    }
  }
}

main();
3.4.3

6 months ago

3.4.2

6 months ago

3.4.1

6 months ago

3.4.0

6 months ago

3.3.0

6 months ago

3.2.0

6 months ago

3.1.0

6 months ago