@edirect/slack
The EDirectInsure Slack module.
Installation
$ npm i --save @edirect/**slack**
Usage
Import and register SlackModule in AppModule (app.module.ts):
import { ConfigService } from '@edirect/config';
...
imports: [
SlackModule.registerAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
active: configService.get(Variables.SLACK_ACTIVE),
service: 'Susbcription Service',
cluster: configService.get(Variables.NAMESPACE),
slack: {
token: configService.get(Variables.SLACK_TOKEN),
channel: configService.get(Variables.SLACK_CHANNEL)
},
}),
inject: [ConfigService],
}),
...
]
Use the public methods in the code, where applicable:
async sendMessage(
level: MessageLevel,
message: string,
payload?: string,
attributes?: Record<string, string>,
channel?: string,
template?: (data: TemplateInput) => KnownBlock[]
): Promise<string>