New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

wbm

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wbm

wbm is an API to send bulk messages in whatsapp.

  • 1.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
144
decreased by-31.43%
Maintainers
1
Weekly downloads
 
Created
Source

npm version

wbm

wbm is an API to send bulk messages in whatsapp.

Installation

> npm install wbm

Usage

At the beginning it will display a QR Code on terminal, just scan it using whatsapp app.

Send same message to every contact

const wbm = require('wbm');

wbm.start().then(async () => {
    const phones = ['5535988841854', '35988841854', '5535988841854'];
    const message = 'Good Morning.';
    await wbm.send(phones, message);
}).catch(err => console.log(err));

Send custom message to every contact

const wbm = require('wbm');

wbm.start().then(async () => {
    const contacts = [{ phone: '5535988841854', name: 'Bruno', age: 21 }];
    const message = 'Hi {{name}}, your age is {{age}}';
    // it will send 'Hi Bruno, your age is 21'
    await wbm.sendCustom(contacts, message); 
}).catch(err => console.log(err));

Send custom messages using YOUR OWN RULE

const wbm = require('wbm');

wbm.start().then(async () => {
    const contacts = [
        { phone: '5535988841854', name: 'Bruno', group: 'friend' }, 
        { phone: '5535988841854', name: 'Will', group: 'customer' }
    ];
    for (contact of contacts) {
        let message = 'hi';
        if(contact.group === 'customer') {
            message = 'Good morning ' + contact.name;
        }
        else if(contact.group === 'friend') {
            message = 'Hey ' + contact.name + '. Wassup?';
        }
        await wbm.sendTo(contact.phone, message);
    }
    await wbm.end();
}).catch(err => console.log(err));

API

send(phones, message)

Send same message to every phone number.

phones

Array of phone numbers: ['5535988841854', ...].
Type: array

message

Message to send to every phone number.
Type: string

sendCustom(contacts, message)

Send custom message to every phone number.

contacts

Array of contact objects created by the user(with dynamic properties)
like [{phone: '5535988841854', name: 'Will', group: 'partner', age: 22', any: 'anything', ...}, ...].
Type: array

message

Message prototype to send to every phone number, text with curly braces like {{text}}
will be replaced by the contact property with same text name.
Type: string

sendTo(phone, message)

Send message to a phone number.

phone

Phone number: '5535988841854'.
Type: string

message

Message to send to phone number.
Type: string

Contributing

Feel free to create pull requests. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Keywords

FAQs

Package last updated on 22 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc