0.1.20 • Published 9 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
9 months ago
0.1.19
9 months ago
0.1.18
9 months ago
0.1.17
9 months ago
0.1.16
9 months ago
0.1.15
9 months ago
0.1.14
9 months ago
0.1.13
9 months ago
0.1.12
9 months ago
0.1.11
9 months ago
0.1.10
9 months ago
0.1.9
9 months ago
0.1.8
9 months ago
0.1.7
9 months ago
0.1.6
9 months ago
0.1.5
9 months ago
0.1.4
9 months ago
0.1.3
9 months ago
0.1.2
9 months ago
0.1.1
9 months ago
0.1.0
9 months ago
0.0.10
9 months ago
0.0.9
9 months ago
0.0.8
9 months ago
0.0.7
9 months ago
0.0.6
9 months ago
0.0.5
9 months ago
0.0.4
9 months ago
0.0.3
9 months ago
0.0.2
9 months ago
0.0.1
9 months ago