This package provides additional utility functions for Slack like automatically sending exception message to slack on exception and many more features to come
- Create a
.npmrc
in the root folder and add the following lines.
//npm.pkg.github.com/:_authToken=TOKEN
@goapptiv:registry=https://npm.pkg.github.com/
-
Create a personal token with read:packages permission and replace the
TOKEN
with your personal token in the above mentioned file. -
Install the package using the following command
npm install @goapptiv/slack-helper-nestjs
- Register the SlackHelperModule in your root module
SlackHelperModule.registerAsync({
isGlobal: true,
imports: [AppConfigModule],
useFactory: (appConfigService: AppConfigService) => ({
appEnv: appConfigService.appEnvironment,
channels: {
default: 'general',
general: 'general',
exceptions: 'exception',
},
}),
inject: [AppConfigService],
});
- Pass eventEmitter
This package internally uses @goapptiv/exception-handler-nestjs, so make sure to pass the eventEmitter to exception-handler filters.
It does everything automatically!
1) ERROR [ExceptionHandler] Nest can't resolve dependencies of the SlackService (?, SlackWebClient, SlackGoogleLogging). Please make sure that the argument SlackModuleOptions at index [0] is available in the SlackHelperModule context.
Solution: Make you have made the SlackModule (provided by nestjs-slack) as Global.