Basic Menu
Basic menu navigating to two sub-menus with the option to return to the main menu.
import { BaileysProvider as Provider } from '@builderbot/provider-baileys'
import { createBot, createProvider, createFlow } from '@builderbot/bot'
import { MemoryDB as Database } from '@builderbot/bot'
import welcomeFlow from './flows/welcomeFlow'
import option1 from './flows/flowOption1'
import option2 from './flows/flowOption2'
import { config } from 'dotenv'
config()
const PHONE_NUMBER = process.env.PHONE_NUMBER
const main = async () => {
const adapterFlow = createFlow([welcomeFlow, option1, option2])
const adapterProvider = createProvider(Provider, { usePairingCode: true, phoneNumber: PHONE_NUMBER })
const adapterDB = new Database()
const botResult = await createBot(
{
flow: adapterFlow,
provider: adapterProvider,
database: adapterDB,
}
)
}
main()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.