@koibanx/notification-sdk
v1.0.1
Published
Notification SDK
Downloads
990
Readme
Koibanx Notification SDK
Description
Notification SDK based in module Notifications
SDK Documentation
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: '[email protected]',
sender: '[email protected]',
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)
})