@koibanx/notification-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Koibanx Notification SDK

Description

Notification SDK based in module Notifications

SDK Documentation

Feast yourself

Koibanx module dependencies

Installation

npm install @koibanx/notification-sdk

NOTE: you must have the npm token in your .npmrc file


Initialization

Node

Using ES6 import

import NotificationApi from '@koibanx/notification-sdk';

const notificationApi = NotificationApi({
    baseURL: 'http://localhost:3005',
    headers: {
        "Authorization": "JWT some-token",
    }
});

With require

exports.__esModule = true;
const NotificationApi = require('@koibanx/notification-sdk')["default"];

const notificationApi = NotificationApi({
    baseURL: 'http://localhost:3005',
    headers: {
        "Authorization": "JWT some-token",
    }
});

Types

  • Typescript (@koibanx/notification-sdk/dist/index.d.ts)

Examples

Using ES6 import

import NotificationsSdk, { NotificationType } from "@koibanx/notification-sdk";

const notification = NotificationsSdk({
    baseURL: 'http://your-url',
    headers: {
        "Authorization": "JWT some-token",
    },
})

notification.sendNotification({
    type: NotificationType.MAIL,
    url: '',
    body: 'This is a text',
    receiver: 'user@domain.com',
    sender: 'user@domain.com',
    title: 'This is a title'
}).then((res) => {
    console.log('Response: ', res);
}).catch((err: any) => {
    console.log('this details: ', err.details);
    console.log('this shortMessage: ', err.message);
    console.log('this errorCode', err.code)
})

notification.sms.sendSms({
    phone: '1000000000',
    text: 'This is a text'
}).then((res) => {
    console.log('Response: ', res);
}).catch((err) => {
    console.log(err.details);
    console.log(err.code)
    console.log(err.message)
})

Readme

Keywords

none

Package Sidebar

Install

npm i @koibanx/notification-sdk

Weekly Downloads

196

Version

1.0.1

License

ISC

Unpacked Size

22 kB

Total Files

29

Last publish

Collaborators

  • npm_koibanx
  • infra-koibanx