A progressive Node.js framework for building efficient and scalable server-side applications.
Library for sending webhook messages to Microsoft Teams chanel
npm i @truongezgg/nest-teams-webhook
Prepare URL Send notification on a Microsoft Teams channel from a Data Factory pipeline
- Module
import { TeamsWebhookModule } from '@truongezgg/nest-teams-webhook';
import { Module } from '@nestjs/common';
@Module({
imports: [
TeamsWebhookModule.register("CHANEL_WEBHOOK_URL_HERE")
],
controllers: [],
providers: [],
})
export class ExampleModule {}
- Service
@Injectable()
export class ExampleService {
constructor(private readonly teamsWebhookService: TeamsWebhookService) {}
async sendMessage() {
// Send message
await this.teamsWebhookService.sendMessage("Hello, this is message");
}
async sendMessageCard() {
// Template OTP
await this.teamsWebhookService.sendMessageCard({
title: "Webhook message",
subtitle: "Forgot password",
facts: {
"Environment": "development",
"Phone": "0123456789",
"Verification code": "123456",
"Expires at": "2022-01-01T00:00:00Z"
}
});
}
async sendRaw() {
// Send without custom body
await this.teamsWebhookService.sendRaw({ text: "This is raw message" });
}
}