🚀 ¡Nuevo! builderbot cloud para No-code ¡Pruébalo gratis!

Why BuilderBot?

BuilderBot is the framework for the creation of ChatBots focused on low-frequency communication channels, whatsapp, telegram, etc. We implement an architecture focused on improving the developer experience and the reuse of logic at all times, if you need to create chatbots for whatsapp quickly, without limits and easy connection between different providers then BuilderBot is for you.


The library is based on three key components for its correct functioning: the Flow, in charge of building the context of the conversation and offering a friendly interface to the developer; the Provider, which acts as a connector allowing to easily switch between WhatsApp providers without the risk of affecting other parts of the bot; and the Database, which in line with this connector philosophy, facilitates changing the data persistence layer without the need to rewrite the workflow.

Flow

Refers to creating structured sequences of interactions, as in building conversation flows. Two key methods are addKeyword and addAnswer, which allow keywords to be associated with specific responses, providing options for customizing the conversation flow.

import { addKeyword } from '@builderbot/bot'

addKeyword(['hello','hi']).addAnswer('Ey! welcome')

Some examples of how to use the addKeyword in which you can place the keyword or a list of keywords that will be used to start a conversational flow

// Example with single keyword
addKeyword('hello').addAnswer('Ey! welcome')

// Example with multi keywords
addKeyword(['hello','hi']).addAnswer('Ey! welcome')

For a quick understanding of the operation we have prepared a basic example of how to implement


Provider

It is a key piece used to deliver the message to the chosen supplier. In a case you are building a bot for whatsapp you should use an adapter like Meta, Twilio, Baileys, etc or even if you want to connect to Telegram.

import { addKeyword, MemoryDB, createProvider, createFlow } from '@builderbot/bot'
import { BaileysProvider } from '@builderbot/provider-baileys'

// ...stuff code...

const main = async () => {
    
    await createBot({
        database: new MemoryDB(),
        provider: createProvider(BaileysProvider),
        flow: createFlow([flowDemo])
    })
}

main()

Database

Just as providers can be easily exchanged between adapters, we can do the same with the database. Now the important thing to understand is how it works. The main purpose of the database inside the bot is to provide the bot with a record of the different events that have occurred between different conversations.

It is ready to implement adapters from Mongo, MySQL, Postgres, among others.

import { addKeyword, MemoryDB, createProvider, createFlow } from '@builderbot/bot'
import { BaileysProvider } from '@builderbot/provider-baileys'

// ...stuff code...

const main = async () => {
    
    await createBot({
        database: new MemoryDB(),
        provider: createProvider(BaileysProvider),
        flow: createFlow([flowDemo])
    })
}

main()

Guides

My first chatbot

Learn how build your first chatbot in few minutes

Read more

Concepts

Understand the essential concepts for building bots

Read more

Add Functions

The key to learning how to write flows is add-functions.

Read more

Plugins

Unlimitate and start implementing the community plugins.

Read more

Resources

Modularize

Learn how to modularise flows so that you can have a more maintainable bot.

Send Message

How to send a message via HTTP to start conversations, you can send multimedia as well.

Dockerizer

A good practice is to dockerise your bots to make them more maintainable and effective.

Events

Learning about events will make us more fluent when creating chatbots.