GithubHelp home page GithubHelp logo

sourcefuse / loopback4-notifications Goto Github PK

View Code? Open in Web Editor NEW
34.0 15.0 14.0 1.75 MB

An extension for setting up various notification mechanisms in loopback4 application, vis-a-vis, Push notification, SMS notification, Email notification

License: MIT License

JavaScript 7.62% TypeScript 90.95% Shell 0.25% EJS 1.18%
loopback4 loopback-next loopback4-extension push-notifications email-notification sms-notifications pubnub aws-ses aws-sns arcbysf

loopback4-notifications's Introduction

ARC By SourceFuse logo

npm version Sonar Quality Gate Synk Status GitHub contributors downloads License Powered By LoopBack 4

Overview

This is a loopback-next extension for adding different notification mechanisms vis-à-vis, Push, SMS, Email to any loopback 4 based REST API application or microservice.

It provides a generic provider-based framework to add your own implementation or implement any external service provider to achieve the same. There are 3 different providers available to be injected namely, PushProvider, SMSProvider and EmailProvider. It also provides support for 7 very popular external services for sending notifications.

  1. AWS Simple Email Service - It's one of the EmailProvider for sending email messages.
  2. AWS Simple Notification Service - It's one of the SMSProvider for sending SMS notifications.
  3. Pubnub - It's one of the PushProvider for sending realtime push notifications to mobile applications as well as web applications.
  4. Socket.IO - It's one of the PushProvider for sending realtime push notifications to mobile applications as well as web applications.
  5. FCM - It's one of the PushProvider for sending realtime push notifications to mobile applications as well as web applications.
  6. Nodemailer - It's one of the EmailProvider for sending email messages.
  7. Apple Push Notification service - It's one of the push notification providers that integrates notification service created by Apple Inc. that enables third party application developers to send notification data to applications installed on Apple devices.
  8. Twilio SMS Service - Twilio is a modern communication API Used by developers for establishing communications. Twilio can be used for sending SMS or Whatapp notifications. You can use one of these services or add your own implementation or integration using the same interfaces and attach it as a provider for that specific type.

You can use one of these services or add your own implementation or integration using the same interfaces and attach it as a provider for that specific type.

Installation

npm install loopback4-notifications

Usage

In order to use this component into your LoopBack application, please follow below steps.

Add component to application.

// application.ts
import {NotificationsComponent} from 'loopback4-notifications';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    // ...
  }
}

After the above, you need to configure one of the notification provider at least. Based upon the requirement, please choose and configure the respective provider for sending notifications. See below.

Email Notifications using Amazon Simple Email Service

This extension provides in-built support of AWS Simple Email Service integration for sending emails from the application. In order to use it, run npm install aws-sdk, and then bind the SesProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {SesProvider} from 'loopback4-notifications/ses';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.EmailProvider).toProvider(SesProvider);
    // ...
  }
}

There are some additional configurations needed in order to allow SES to connect to AWS. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {SesProvider, SESBindings} from 'loopback4-notifications/ses';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(SESBindings.Config).to({
      accessKeyId: process.env.SES_ACCESS_KEY_ID,
      secretAccessKey: process.env.SES_SECRET_ACCESS_KEY,
      region: process.env.SES_REGION,
    });
    this.bind(NotificationBindings.EmailProvider).toProvider(SesProvider);
    // ...
  }
}

All the configurations as specified by AWS docs here are supported in above SESBindings.Config key.

In addition to this, some general configurations can also be done, like below.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {SesProvider, SESBindings} from 'loopback4-notifications/ses';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.Config).to({
      sendToMultipleReceivers: false,
      senderEmail: '[email protected]',
    });
    this.bind(SESBindings.Config).to({
      accessKeyId: process.env.SES_ACCESS_KEY_ID,
      secretAccessKey: process.env.SES_SECRET_ACCESS_KEY,
      region: process.env.SES_REGION,
    });
    this.bind(NotificationBindings.EmailProvider).toProvider(SesProvider);
    // ...
  }
}

Possible configuration options for the above are mentioned below.

Option Type Description
sendToMultipleReceivers boolean If set to true, single email will be sent to all receivers mentioned in payload. If set to false, multiple emails will be sent for each receiver mentioned in payload.
senderEmail string This will be used as from email header in sent email.

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to SesProvider we have. Add that provider in place of SesProvider. Refer to the implementation here.

this.bind(NotificationBindings.EmailProvider).toProvider(MyOwnProvider);

Email Notifications Using Nodemailer

This extension provides in-built support of Nodemailer integration for sending emails from the application. In order to use it, run npm install nodemailer, and then bind the NodemailerProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {NodemailerProvider} from 'loopback4-notifications/nodemailer';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.EmailProvider).toProvider(
      NodemailerProvider,
    );
    // ...
  }
}

There are some additional configurations needed in order to allow NodeMailer to works. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {
  NodemailerProvider,
  NodemailerBindings,
} from 'loopback4-notifications/nodemailer';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NodemailerBindings.Config).to({
      pool: true,
      maxConnections: 100,
      url: '',
      host: 'smtp.example.com',
      port: 80,
      secure: false,
      auth: {
        user: 'username',
        pass: 'password',
      },
      tls: {
        rejectUnauthorized: true,
      },
    });
    this.bind(NotificationBindings.EmailProvider).toProvider(
      NodemailerProvider,
    );
    // ...
  }
}

All the configurations as specified by Nodemailer docs for SMTP transport here are supported in above NodemailerBindings.Config key.

In addition to this, some general configurations can also be done, like below.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {
  NodemailerProvider,
  NodemailerBindings,
} from 'loopback4-notifications/nodemailer';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.Config).to({
      sendToMultipleReceivers: false,
      senderEmail: '[email protected]',
    });
    this.bind(NodemailerBindings.Config).to({
      pool: true,
      maxConnections: 100,
      url: '',
      host: 'smtp.example.com',
      port: 80,
      secure: false,
      auth: {
        user: 'username',
        pass: 'password',
      },
      tls: {
        rejectUnauthorized: true,
      },
    });
    this.bind(NotificationBindings.EmailProvider).toProvider(
      NodemailerProvider,
    );
    // ...
  }
}

Possible configuration options for the above are mentioned below.

Option Type Description
sendToMultipleReceivers boolean If set to true, single email will be sent to all receivers mentioned in payload. If set to false, multiple emails will be sent for each receiver mentioned in payload.
senderEmail string This will be used as from email header in sent email.

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to NodemailerProvider we have. Add that provider in place of NodemailerProvider. Refer to the implementation here.

this.bind(NotificationBindings.EmailProvider).toProvider(MyOwnProvider);

SMS Notifications using AWS SNS

This extension provides in-built support of AWS Simple Notification Service integration for sending SMS from the application. In order to use it, run npm install aws-sdk, and then bind the SnsProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {SnsProvider} from 'loopback4-notification/sns';
// ...

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.SMSProvider).toProvider(SnsProvider);
    // ...
  }
}

There are some additional configurations needed in order to allow SNS to connect to AWS. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {SNSBindings, SnsProvider} from 'loopback4-notification/sns';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(SNSBindings.Config).to({
      accessKeyId: process.env.SNS_ACCESS_KEY_ID,
      secretAccessKey: process.env.SNS_SECRET_ACCESS_KEY,
      region: process.env.SNS_REGION,
    });
    this.bind(NotificationBindings.SMSProvider).toProvider(SnsProvider);
    // ...
  }
}

All the configurations as specified by AWS docs here are supported in above SNSBindings.Config key.

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to SnsProvider we have. Add that provider in place of SnsProvider.Refer to the implementation here.

this.bind(NotificationBindings.SMSProvider).toProvider(MyOwnProvider);

SMS / Whatsapp Notifications using Twilio

This extension provides in-built support of Twilio integration for sending SMS / whatsapp notifications from the application. In order to use it, run npm install twilio, and then bind the TwilioProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {
  TwilioProvider
} from 'loopback4-notification/twilio';
....

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    ....

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.SMSProvider).toProvider(TwilioProvider);
    ....
  }
}

There are some additional configurations needed in order to connect to Twilio. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {
  TwilioBindings,
  TwilioProvider
} from 'loopback4-notification/twilio';
....

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    ....

    this.component(NotificationsComponent);
    this.bind(TwilioBindings.Config).to({
      accountSid: process.env.TWILIO_ACCOUNT_SID,
      authToken: process.env.TWILIO_AUTH_TOKEN,
      waFrom: process.env.TWILIO_WA_FROM,
      smsFrom: process.env.TWILIO_SMS_FROM,
      waStatusCallback:process.env.TWILIO_WA_STATUS_CALLBACK,
      smsStatusCallback:process.env.TWILIO_SMS_STATUS_CALLBACK,
    });
    this.bind(NotificationBindings.SMSProvider).toProvider(TwilioProvider);
    ....
  }
}

All the configurations as specified by Twilio docs and console are supported in above TwilioBindings Config key. smsFrom could be messaging service id, twilio number or short code. waFrom could be whats app number or number associated to channel.

Push Notifications with Pubnub

This extension provides in-built support of Pubnub integration for sending realtime push notifications from the application. In order to use it, run npm install pubnub, and then bind the PushProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {PubNubProvider} from 'loopback4-notifications/pubnub';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.PushProvider).toProvider(PubNubProvider);
    // ...
  }
}

There are some additional configurations needed in order to allow Pubnub connection. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {PubnubBindings, PubNubProvider} from 'loopback4-notifications/pubnub';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(PubNubProvider.Config).to({
      subscribeKey: process.env.PUBNUB_SUBSCRIBE_KEY,
      publishKey: process.env.PUBNUB_PUBLISH_KEY,
      secretKey: process.env.PUBNUB_SECRET_KEY,
      ssl: true,
      logVerbosity: true,
      uuid: 'my-app',
      cipherKey: process.env.PUBNUB_CIPHER_KEY,
      apns2Env: 'production',
      apns2BundleId: 'com.app.myapp',
    });
    this.bind(NotificationBindings.PushProvider).toProvider(PubNubProvider);
    // ...
  }
}

All the configurations as specified by Pubnub docs here are supported in above PubNubProvider.Config key.

Additionally, PubNubProvider also supports Pubnub Access Manager integration. Refer docs here for details.

For PAM support, PubNubProvider exposes two more methods - grantAccess and revokeAccess. These can be used to grant auth tokens and revoke them from Pubnub.

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to PubNubProvider we have. Add that provider in place of PubNubProvider. Refer to the implementation here.

this.bind(NotificationBindings.PushProvider).toProvider(MyOwnProvider);

Push Notifications With Socket.io

This extension provides in-built support of Socket.io integration for sending realtime notifications from the application. In order to use it, run npm install socket.io-client, and bind the PushProvider as below in application.ts.

This provider sends the message to the channel passed via config (or while publishing) and accepts a fix interface to interact with. The interface could be imported into the project by the name SocketMessage.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {SocketIOProvider} from 'loopback4-notifications/socketio';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(NotificationBindings.PushProvider).toProvider(SocketIOProvider);
    // ...
  }
}

There are some additional configurations needed in order to allow Socket connection. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {
  SocketBindings,
  SocketIOProvider,
} from 'loopback4-notifications/socketio';

export class NotificationServiceApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...

    this.component(NotificationsComponent);
    this.bind(SocketBindings.Config).to({
      url: process.env.SOCKETIO_SERVER_URL,
    });
    this.bind(NotificationBindings.PushProvider).toProvider(SocketIOProvider);
    // ...
  }
}

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to SocketIOProvider we have. Add that provider in place of SocketIOProvider. Refer to the implementation here.

this.bind(NotificationBindings.PushProvider).toProvider(MyOwnProvider);

Push Notifications With FCM

This extension provides in-built support of Firebase Cloud Messaging integration for sending realtime push notifications from the application. In order to use it, run npm i firebase-admin, and then bind the PushProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {FcmProvider} from 'loopback4-notifications/fcm';
export class MyApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...
    this.component(NotificationsComponent);
    this.bind(NotificationBindings.PushProvider).toProvider(FcmProvider);
    // ...
  }
}

There are some additional configurations needed in order to use Firebase Cloud Messaging. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {FcmProvider, FcmBindings} from 'loopback4-notifications/fcm';
export class MyApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...
    this.component(NotificationsComponent);
    this.bind(FcmBindings.Config).to({
      apiKey: 'API_KEY',
      authDomain: 'PROJECT_ID.firebaseapp.com',
      // The value of `databaseURL` depends on the location of the database
      databaseURL: 'https://DATABASE_NAME.firebaseio.com',
      projectId: 'PROJECT_ID',
      storageBucket: 'PROJECT_ID.appspot.com',
      messagingSenderId: 'SENDER_ID',
      appId: 'APP_ID',
      // For Firebase JavaScript SDK v7.20.0 and later, `measurementId` is an optional field
      measurementId: 'G-MEASUREMENT_ID',
    });
    this.bind(NotificationBindings.PushProvider).toProvider(FcmProvider);
    // ...
  }
}

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to FcmProvider we have. Add that provider in place of FcmProvider. Refer to the implementation here.

this.bind(NotificationBindings.PushProvider).toProvider(MyOwnProvider);

Push Notifications With APNs

This extension provides in-built support of Apple Push Notification service for sending notification to applications installed on Apple devices. In order to use it bind the PushProvider as below in application.ts.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {ApnsProvider} from 'loopback4-notifications/apns';
export class MyApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...
    this.component(NotificationsComponent);
    this.bind(NotificationBindings.PushProvider).toProvider(ApnsProvider);
    // ...
  }
}

There are some additional configurations needed in order to use Apple Push Notification service. You need to add them as below. Make sure these are added before the provider binding.

import {
  NotificationsComponent,
  NotificationBindings,
} from 'loopback4-notifications';
import {ApnsProvider, ApnsBinding} from 'loopback4-notifications/apns';
export class MyApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  constructor(options: ApplicationConfig = {}) {
    // ...
    this.component(NotificationsComponent);
    this.bind(ApnsBinding.Config).to({
      providerOptions: {
        /* APNs Connection options, see below. */
      };
      options: {
        badge: 1, // optional
        topic: "string"
      };
    });
    this.bind(NotificationBindings.PushProvider).toProvider(ApnsProvider);
    // ...
  }
}

For more information about providerOptions check: provider documentation

If you wish to use any other service provider of your choice, you can create a provider for the same, similar to ApnsProvider we have. Add that provider in place of ApnsProvider. Refer to the implementation here.

this.bind(NotificationBindings.PushProvider).toProvider(MyOwnProvider);

Controller Usage

Once the providers are set, the implementation of notification is very easy. Just add an entity implementing the Message interface provided by the component. For specific type, you can also implement specific interfaces like, SMSMessage, PushMessage, EmailMessage. See example below.

import {Entity, model, property} from '@loopback/repository';
import {
  Message,
  Receiver,
  MessageType,
  MessageOptions,
} from 'loopback4-notifications';

@model({
  name: 'notifications',
})
export class Notification extends Entity implements Message {
  @property({
    type: 'string',
    id: true,
  })
  id?: string;

  @property({
    type: 'string',
    jsonSchema: {
      nullable: true,
    },
  })
  subject?: string;

  @property({
    type: 'string',
    required: true,
  })
  body: string;

  @property({
    type: 'object',
    required: true,
  })
  receiver: Receiver;

  @property({
    type: 'number',
    required: true,
  })
  type: MessageType;

  @property({
    type: 'date',
    name: 'sent',
  })
  sentDate: Date;

  @property({
    type: 'object',
  })
  options?: MessageOptions;

  constructor(data?: Partial<Notification>) {
    super(data);
  }
}

After this, you can publish notification from controller API methods as below. You don't need to invoke different methods for different notification. Same publish method will take care of it based on message type sent in request body.

export class NotificationController {
  constructor(
    // ...
    @inject(NotificationBindings.NotificationProvider)
    private readonly notifProvider: INotification,
  ) {}

  @post('/notifications', {
    responses: {
      [STATUS_CODE.OK]: {
        description: 'Notification model instance',
        content: {
          [CONTENT_TYPE.JSON]: {schema: getModelSchemaRef(Notification)},
        },
      },
    },
  })
  async create(
    @requestBody({
      content: {
        [CONTENT_TYPE.JSON]: {
          schema: getModelSchemaRef(Notification, {exclude: ['id']}),
        },
      },
    })
    notification: Omit<Notification, 'id'>,
  ): Promise<Notification> {
    await this.notifProvider.publish(notification);
  }
}

As you can see above, one controller method can now cater to all the different type of notifications.

Feedback

If you've noticed a bug or have a question or have a feature request, search the issue tracker to see if someone else in the community has already created a ticket. If not, go ahead and make one! All feature requests are welcome. Implementation time may vary. Feel free to contribute the same, if you can. If you think this extension is useful, please star it. Appreciation really helps in keeping this project alive.

Contributing

Please read CONTRIBUTING.md for details on the process for submitting pull requests to us.

Code of conduct

Code of conduct guidelines here.

License

MIT

loopback4-notifications's People

Contributors

akshatdubeysf avatar ankurbansalsf avatar arnaud16571542 avatar arpit1503khanna avatar ashutosh-bansal-2136 avatar barleendhaliwal avatar dependabot[bot] avatar gautam23-sf avatar jyoti-13 avatar mayank-sfin571 avatar raghavarorasf avatar sachin6161 avatar sadarunnisa-sf avatar samarpan-b avatar semantic-release-bot avatar sfdevops avatar shubhamp-sf avatar surbhi-sharma1 avatar tyagi-sunny avatar yeshamavani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loopback4-notifications's Issues

PushNotification is not exported using any main or /push

Describe the bug
to use PushNotification, we need to import it like :

import {PushNotification} from 'loopback4-notifications/dist/providers/push/index';

Expected behavior
It must be like :
import {PushNotification} from 'loopback4-notifications/push'

Says aws-sdk missing even when I just need to use the Pubnub Notifications.

Describe the bug
After installing the package and running the project, it says 'aws-sdk' is missing.

To Reproduce
Steps to reproduce the behavior:

  1. Install the 'loopback4-notifications' package.
  2. Follow the readme usage steps for Pubnub notifications.
  3. Run the application.
  4. It throws an error saying 'aws-sdk' is required.

Expected behavior
It should not ask to install 'aws-sdk' when I don't need it.

Correct the changelog Format

Describe the bug
Right now Issue description is not visible in the changelog
To Reproduce
Steps to reproduce the behavior:

  1. Release a new version
  2. check the changelog
  3. Issue Description not visible
  4. Issue link not clickable

Semantic Release

Is your feature request related to a problem? Please describe.
Adding semantic release for automatic release of packages.

Describe the solution you'd like
Using npm semantic-release

Describe alternatives you've considered

Additional context

Update all dependencies

  • update all dependencies ( including dev and peer dependencies)
  • use node version 16 for the same

Test case coverage lacking

Describe the bug
Test case coverage missing and not up to the mark

To Reproduce
We should have at least 75% unit test case coverage for this package.

Remove support for node v14

Is your feature request related to a problem? Please describe.
Node v14 reaching its end of life this month. Loopback removes support for node v14 in all of its packages we depend on.

Sourceloop packages/services also currently have v12 and v14 as the supported versions.

Describe the solution you'd like
Remove the support for node v14 and v12. And add the support for the latest LTS version v18.

Describe alternatives you've considered
__

Additional context
__

Setup Release Process via GH Actions

Is your feature request related to a problem? Please describe.
After the sourceloop release processes regression on jenkins the release of packages needs to be done locally.

Describe the solution you'd like
Set up a manually dispatch-able github action to publish releases.

Describe alternatives you've considered
The possible alternate is to publish packages locally but that requires keeping the credentials environment already setup.

Additional context
__

Need twilio support for SMS/Whatsapp

Is your feature request related to a problem? Please describe.
Need to send SMS via twilio

Describe the solution you'd like
Twilio as a provider for SMS

Describe alternatives you've considered
AWS SNS is not a good option for SMS as its delivery is unreliable

Additional context
Add any other context or screenshots about the feature request here.

Create the PR template

Describe the bug
The PR template is missing in this repo

To Reproduce
When we create a PR no template is used

Expected behavior
There should be a PR template

Request for more detailed and customizable changelog

Is your feature request related to a problem? Please describe.
Right now the changelog created for releases is not well in detail and informative.
Request to generate detailed changelog.

Describe the solution you'd like
Can use different npm packages available

semantic-release : patch release for chore

Describe the bug
Changes for semantic-release
when dependencies are updated with chore type new version is not released

To Reproduce
try updating the dependencies using chore(deps)

Expected behavior
when dependencies are updated with chore type new version must be released

Stale Bot missing in the repository

Describe the bug
Currently the issues and PR never closed even if inactive.
They should be closed automatically.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new issue/Pr
  2. Observe it.
  3. Even after no activity it stays open.

Expected behavior
Inactive issues/Pr should be closed automatically.

Support for Apple Push Notification service

Is your feature request related to a problem? Please describe.
There should be a way to send notifications through APNS.

Describe the solution you'd like
Can create a new provided similar to the FCM provider, using the node-apn or any other equivalent library to send notifications through APNS.

Additional context
There is already a way to send APNS based notifications using Pubnub but that requires Pubnub, there should be an independent way to send such notifications like there is for FCM based notifications.

loopback version updates

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Error [ConfigError]: Missing region in config

Describe the bug
When trying to send SMS I am getting this error

To Reproduce
Follow the steps in the documentation of this repository. Include the required keys and region in .env file.

code
await this.notificationProvider.publish({ body: 'OTP:' + authOtp.otp, receiver: {to: [{id: '9876543210/*replaced the actual phone number*/'}]}, sentDate: new Date(), type: MessageType.SMS }).catch(smsError => { console.log(smsError); });

Expected behavior
No error.

Screenshots
image

Additional context

Package Update - loopback4-notifications

Describe the bug
remove all current vilnenrability of loopback4-notifications.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.