Providers

Providers are in charge of providing the communication bridge between your bot and whatsapp, telegram or custom provider.

You can change your provider very easily without affecting the logic of your bot. It is as simple as implementing the connector of the provider of your choice. At the moment we have integrations with more than four suppliers.

Each provider may need to adjust access keys, settings, among other properties that are usually passed as an object in the createProvider function.

import { createProvider } from "@builderbot/bot";
import { MetaProvider } from '@builderbot/provider-meta';

export type IProvider = typeof MetaProvider
export const adapterProvider = createProvider(MetaProvider, {
    jwtToken: 'jwtToken',
    numberId: 'numberId',
    verifyToken: 'verifyToken',
    version: 'v16.0',
})

Below you will find more information about each of these providers.


Meta

The WhatsApp Business Platform enables medium and large businesses to communicate with their customers on a large scale. You can initiate conversations with customers in just minutes, send them customer service notifications or purchase updates, offer them a personalized level of service, and provide support through the channel of their choice.

import { createProvider } from "@builderbot/bot";
import { MetaProvider } from '@builderbot/provider-meta';

export type IProvider = typeof MetaProvider
export const adapterProvider = createProvider(MetaProvider, {
    jwtToken: 'jwtToken',
    numberId: 'numberId',
    verifyToken: 'verifyToken',
    version: 'v16.0',
})

Twilio

Twilio is a development platform that enables developers to build cloud communication applications and web systems. Twilio's communications APIs enable businesses to provide the right communication experience for their customers within web and mobile applications. By using Twilio APIs, developers can quickly add this functionality to an application, such as voice messaging, video calls, text messaging and more.

import { createProvider } from "@builderbot/bot";
import { TwilioProvider } from '@builderbot/provider-twilio';

export type IProvider = typeof TwilioProvider
export const adapterProvider = createProvider(TwilioProvider, {
    accountSid: 'YOUR_ACCOUNT_SID',
    authToken: 'YOUR_ACCOUNT_TOKEN',
    vendorNumber: '+14155238886',
    publicUrl: "public_url", //optional
});

Baileys

Baileys is an open source project which allows sending messages, receiving messages and dozens of other features by implementing WebSocket in a version of whatsapp. It is a project with great trajectory driven by people with great knowledge of the subject, you can deepen in this library directly in its documentation or repository.

Because this is a free provider that emulates the whatsapp web interface, you must scan the QR to log in.

import { createProvider } from "@builderbot/bot";
import { BaileysProvider } from '@builderbot/provider-baileys';

export type IProvider = typeof BaileysProvider
export const adapterProvider = createProvider(BaileysProvider)


Venom

Venom is an open-source project that utilizes JavaScript to create high-performance bots for WhatsApp. It supports a wide range of interactions including customer care, media sending, AI-based phrase recognition, and various architectural designs tailored for WhatsApp. You can visit their official website as the repository to understand other features you can use.

Because this is a free provider that emulates the whatsapp web interface, you must scan the QR to log in.

import { createProvider } from "@builderbot/bot";
import { VenomProvider } from '@builderbot/provider-venom';

export type IProvider = typeof VenomProvider
export const adapterProvider = createProvider(VenomProvider)

WPPConnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination You can visit their official website as the repository to understand other features you can use.

Because this is a free provider that emulates the whatsapp web interface, you must scan the QR to log in.

import { createProvider } from "@builderbot/bot";
import { WPPConnectProvider } from '@builderbot/provider-wppconnect';

export type IProvider = typeof WPPConnectProvider
export const adapterProvider = createProvider(WPPConnectProvider)

Wali.chat Provider

Custom Provider

Custom provider there is the possibility to build your own customized adapter, we know that there are many more providers that can be very useful, an example can be Wali.chat which apart from giving us the possibility to interact via API Rest also offers a Dashboard to visualize and share data with your agents.

import { createBot, createProvider, createFlow, addKeyword, utils } from '@builderbot/bot'
import { MemoryDB as Database } from '@builderbot/bot'
import { WaliProvider as Provider } from './provider/wali'

const PORT = process.env.PORT ?? 3008

const fullSamplesFlow = addKeyword<Provider, Database>(['samples', utils.setEvent('SAMPLES')])
    .addAnswer(`💪 I'll send you a lot files...`)
    .addAnswer(`Send video from URL`,
        { media: 'https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYTJ0ZGdjd2syeXAwMjQ4aWdkcW04OWlqcXI3Ynh1ODkwZ25zZWZ1dCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/LCohAb657pSdHv0Q5h/giphy.mp4' }
    )
    .addAnswer(`Send audio from URL`,
        { media: 'https://cdn.freesound.org/previews/728/728142_11861866-lq.mp3' }
    )
    .addAnswer(`Send file from URL`,
        { media: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf' }
    )


const main = async () => {
    const adapterFlow = createFlow([fullSamplesFlow])

    const adapterProvider = createProvider(Provider, {
        token: process.env.TOKEN,
        deviceId: process.env.DEVICE_ID
    })
    const adapterDB = new Database()

    const { httpServer } = await createBot({
        flow: adapterFlow,
        provider: adapterProvider,
        database: adapterDB,
    })

    httpServer(+PORT)
}

main()