@easynotification/core
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

EasyNotification Core

Website

A powerful and flexible notification system built with NestJS that supports multiple notification channels. This is the core module of the EasyNotification project, providing the foundation for sending notifications through various channels.

Features

  • 📱 Telegram notifications
  • 📧 Email notifications
  • 📥 MeliPayamak

Installation

npm install @easynotification/core

Supported Channels

Telegram

Send notifications directly to Telegram chats using bot tokens.

Email

Send email notifications with support for HTML templates.

MeliPayamak Website

Send SMS With MeliPayamak Console Api

Setup

import { EasyNotificationModule } from "@easynotification/core";

@Module({
  imports: [
    EasyNotificationModule.register({
      isGlobal: true,
      telegramOptions: {
        token: "your bot token here",
      },
      emailOptions: {
        from: "from",
        auth: {
          password: "password",
          username: "username",
        },
        host: "host",
        port: 587, // 587 or 465
        secure: false, // false for 587 and true for 465
      },
      melipayamakOptions: {
        console_url: "",
      },
    }),
  ],
})
export class AppModule {}
import { EasyNotificationService } from "@easynotification/core";

@Injectable()
export class AppService {
  constructor(private readonly easyNotificationService: EasyNotificationService);
}

const response = await this.easyNotificationService.sendNotification("EMAIL", {
  to: "",
  subject: "",
  html: "",
  text: "",
});

if (response.ok) {
  console.log("Email success response", response.result);
} else {
  console.log("Email error response", response.error);
}

const response = await this.easyNotificationService.sendNotification("TELEGRAM", {
  chat_id: 1,
  text: "",
});

if (response.ok) {
  console.log("Telegram success response", response.result);
} else {
  console.log("Telegram error response", response.error);
}

const response = await this.easyNotificationService.sendNotification("MELIPAYAMAK", {
  to: "phonenumber",
  bodyId: 10000,
  args: ["1", "1000"],
});

if (response.ok) {
  console.log("Melipayamak success response", response.result);
} else {
  console.log("Melipayamak error response", response.error);
}

Future Plans

  • Email ejs support
  • WhatsApp integration
  • SMS notifications
  • Discord integration
  • Website
  • Api Package
  • queues
  • And more...

Created with ❤️ for developers

Package Sidebar

Install

npm i @easynotification/core

Weekly Downloads

10

Version

1.1.0

License

MIT

Unpacked Size

138 kB

Total Files

39

Last publish

Collaborators

  • amirghdev