3.0.0 • Published 2 years ago

haila-sentinel v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years 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.0.0

2 years ago

2.0.10

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago