0.1.20 • Published 10 months ago
@dkanest/whatsapp v0.1.20
Description
Nest framework TypeScript library Whatsapp
Project setup
$ yarn add @dkanest/whatsapp
On Module
import { Module } from '@nestjs/common';
import { WhatsAppModule } from '@dkanest/whatsapp';
import { ModuleService } from './module.service';
@Module({
imports: [
WhatsAppModule.forRoot(
`<your host>`,
{
noDelay: true,
auth: {
username: `<user>`,
password: `<pass>`,
},
dbName: `<db_name>`,
},
),
],
providers: [ModuleService],
})
export class ModuleModule {}
On Service
import { Injectable, OnModuleInit } from '@nestjs/common';
import { generate } from 'qrcode-terminal';
import { WhatsAppService } from '@dkanest/whatsapp';
@Injectable()
export class ModuleService implements OnModuleInit {
constructor(private readonly WhatsApp: WhatsAppService) {
this.WhatsApp.register.on('qr', (qr: string) => {
generate(qr, { small: true });
});
}
onModuleInit() {
this.WhatsApp.register.on('message', (message) => {
console.log('from example', message.body);
});
this.WhatsApp.register.on('ready', () => {
console.log('from module:engine ready');
});
}
}
0.1.20
10 months ago
0.1.19
10 months ago
0.1.18
10 months ago
0.1.17
10 months ago
0.1.16
10 months ago
0.1.15
10 months ago
0.1.14
10 months ago
0.1.13
10 months ago
0.1.12
10 months ago
0.1.11
10 months ago
0.1.10
10 months ago
0.1.9
10 months ago
0.1.8
10 months ago
0.1.7
10 months ago
0.1.6
10 months ago
0.1.5
10 months ago
0.1.4
10 months ago
0.1.3
10 months ago
0.1.2
10 months ago
0.1.1
10 months ago
0.1.0
10 months ago
0.0.10
10 months ago
0.0.9
10 months ago
0.0.8
10 months ago
0.0.7
10 months ago
0.0.6
10 months ago
0.0.5
10 months ago
0.0.4
10 months ago
0.0.3
10 months ago
0.0.2
10 months ago
0.0.1
10 months ago