unisender-ts

unisender-ts

Typescript Interface for Unisender GO web API.

Based on Unisender API documentation.

  • Uses the Fetch API
  • Tree-shakable
  • No dependencies
  • Typescript support
  • 100% test coverage
npm install unisender-ts
import { Unisender } from 'unisender-ts';

const unisender = new Unisender(
"https://go1.unisender.ru/ru/transactional/api/v1",
"<your api key>"
);

await unisender.send({
message: {
recipients: [
{ email: 'example@mail.com' },
],
subject: "Hello, world!",
body: {
plaintext: "This is a test email",
},
global_language: "en",
from_name: "John Doe",
from_email: "j.doe@company.com",
},
});

To reduce the size of the bundle, you can import only the functions you need:


import { send } from 'unisender-ts';

await send(
"https://go1.unisender.ru/ru/transactional/api/v1",
"<your api key>",
{
message: {
recipients: [
{ email: 'example@mail.com' },
],
subject: "Hello, world!",
body: {
plaintext: "This is a test email",
},
global_language: "en",
from_name: "John Doe",
from_email: "j.doe@company.com",
},
},
);

This project uses the bun runtime for development tasks. Linting and formatting is done using biome. Building is done using tsc.

# install dependencies:
bun install
# run tests
bun test
# run linter
bun run lint
# run code formatter
bun run format
# build project
bun run build