0.1.20 • Published 2 years ago

@dkanest/whatsapp v0.1.20

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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

2 years ago

0.1.19

2 years ago

0.1.18

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago