0.3.0 • Published 3 years ago

@egomobile/api-messenger v0.3.0

Weekly downloads
-
License
LGPL-3.0
Repository
github
Last release
3 years ago

npm last build PRs Welcome

@egomobile/api-messenger

A client using an API to send messages, like emails, written in TypeScript.

Install

Execute the following command from your project folder, where your package.json file is stored:

npm install --save @egomobile/api-messenger

Usage

import createApiMessenger from "@egomobile/api-messenger";

async function main() {
  const messenger = createApiMessenger({
    baseURL: "https://api.example.com/",
    auth: {
      clientId: "<YOUR-CLIENT-ID>",
      clientSecret: "<YOUR-CLIENT-SECRET>",
    },
  });

  const result = await messenger.sendMessages({
    message: {
      content: "PGI+TG9yZW0gaXNwdW0hPC9iPg==",
      content_type: "text/html",
    },
    subject: "Lorem ipsum",
    to: ["mailto:test2@example.com", "mailto:test2@example.com"],
  });

  console.log(result);
}

main().catch(console.error);

Documentation

The API documentation can be found here.