1.1.1 • Published 2 months ago

@totigm/whatsapp-bot v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

📄 Introduction

This is a library to create WhatsApp bots. It is a WhatsApp implementation of the @totigm/bot-builder package, which handles all the commands stuff behind the scenes, so you can focus on your bot's logic.

The whatsapp-web.js library is used for this implementation.

🔗 Quick links

💻 Installation

npm i @totigm/whatsapp-bot

or

yarn add @totigm/whatsapp-bot

🚀 Getting started

You can use this WhatsApp bot template to generate your own. This template has everything set up for you, so you can start coding your bot right away.\ The template has TypeScript, Docker, ESLint, and Prettier already configured, so you have a nice developer experience and a production-ready bot.

Start adding commands to your bot by checking the reference documentation.

The WhatsApp bot template and bot examples are also a good reference on how to use this library.

🤖 Example usage

import WhatsappBot from "@totigm/whatsapp-bot";

const bot = new WhatsappBot();

bot.addCommand(
    "hey",
    async (message, client) => {
        const chatId = message.from;
        const contact = await client.getContactById(chatId);

        return `Hey ${contact.pushname}! How are you doing?`;
    },
    {
        description: "Say hey",
        explanation: "The bot will say hey to the user using their WhatsApp's name",
        example: {
            output: "Hey Toti! How are you doing?",
        },
    },
);

The previous code will create a bot that works like this:

bot conversation

🤩 Bot examples

⚙️ Options

When you create a bot, you can pass an options object to customize it. Check its options documentation for more information.

const options = { ... };

const bot = new WhatsappBot(options);

🚀 Deploying

To deploy your WhatsApp bot, check out this template, which creates a Docker image with everything needed for the whatsapp-web.js library to work. This will help you to deploy your bot to the cloud provider of your choice.

This library automatically checks if the app is being run on a Docker container and set its configurations according to that, so you don't have to worry about it.

👤 Author

🤝 Contributing

Contributions are more than welcome!

We think that you might have great ideas to make this project even better. If you do, please create a pull request and/or issue following the contribution guidelines.

⭐️ Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 Toti Muñoz. This project is MIT licensed.


This project was made with ❤ and TypeScript

1.1.1

2 months ago

1.1.0

4 months ago

1.0.14

4 months ago

1.0.13

4 months ago

1.0.12

4 months ago

1.0.11

1 year ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.10

1 year ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.3.945

2 years ago

0.3.944

2 years ago

0.3.943

2 years ago

0.3.942

2 years ago

0.3.941

2 years ago

0.3.94

2 years ago

0.3.93

2 years ago

0.3.92

2 years ago

0.3.91

2 years ago

0.3.9

2 years ago

0.3.8

2 years ago

0.3.79

2 years ago

0.3.78

2 years ago

0.3.77

2 years ago

0.3.76

2 years ago

0.3.75

2 years ago

0.3.74

2 years ago

0.3.73

2 years ago

0.3.72

2 years ago

0.3.71

2 years ago

0.3.7

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.92

2 years ago

0.2.91

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

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.2

2 years ago

0.0.1

2 years ago