Notification SDK
Notification SDK based in module Notifications
`` bash`
npm install @koibanx/notification-sdk
> NOTE: you must have the npm token in your .npmrc file
---
Using ES6 import`ts
import NotificationApi from '@koibanx/notification-sdk';
const notificationApi = NotificationApi({
baseURL: 'http://localhost:3005',
headers: {
"Authorization": "JWT some-token",
}
});
`
With require`js
exports.__esModule = true;
const NotificationApi = require('@koibanx/notification-sdk')["default"];
const notificationApi = NotificationApi({
baseURL: 'http://localhost:3005',
headers: {
"Authorization": "JWT some-token",
}
});
`
- Typescript (@koibanx/notification-sdk/dist/index.d.ts)
---
Using ES6 import``ts
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)
})