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

Meta Provider

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

Requirements

  • Register a Facebook Developers account.
  • You will need to verify your business and your application with official documents, the type of which may vary depending on your country.
  • You will need to associate an official phone number of your business with your account that is not linked to any other WhatsApp account, either regular or Business. For testing purposes, Meta provides a free phone number.
  • Meta offers 1000 free customer-initiated conversations to the bot, and 250 free bot-initiated conversations to the customer. Once this limit is reached, each additional conversation will have a cost that may vary depending on your country or region.

Uses Cases

If you want to give a quick overview of all the options that this provider allows you to implement in conjunction with builderbot you can go through the use cases, where in code we show some of the most important features of this provider. Cases such as sending buttons, lists, or native methods directly with Meta


Meta tutorial video

If you are one of those people who prefer to watch videos, here is a short tutorial on how to implement the Meta base.

Video Meta Provider


You must create a new application. To do this, click on the Create application button.


On this screen, you must select Company or Business.


In the next step, you must enter a name for your application, also enter a contact email address and select the Test Business application.


Now, go to the WhatsApp Settings section.


This is the part where you will find the access token and you can also see the number from where WhatsApp messages are sent and to where they will be sent. As you are in the trial version, you must register the numbers to which you want to send.


On this same page, you can find the Webhook section that we will soon need to use.


In the main file of the bot where you are implementing the meta adapter function, you are going to place the following data:

  • numberId: You can find it on the previous page.
  • jwtToken: You can find it on the previous page.
  • VerifyToken: You can write whatever you want, it's like a keyword.
const main = async () => {
    const adapterDB = new MockAdapter()
    const adapterFlow = createFlow([flowPrincipal])

    const adapterProvider = createProvider(MetaProvider, {
        jwtToken: process.env.JWTOKEN, //EAARBW3ZBGU0UBAACDjtQIzI8JuEa.............
        numberId: process.env.NUMBER_ID, //103975305758520
        verifyToken: process.env.VERIFY_TOKEN, //LO_QUE_SEA,
        version:'v16.0'
    })

    createBot({
        flow: adapterFlow,
        provider: adapterProvider,
        database: adapterDB,
    })
}

main()

After executing the bot, you will find a message in the console similar to the following. Where you can find the URL for your webhook.

$ npm start
> node app.js

[meta]: Add this url "WHEN A MESSAGE COMES IN"
[meta]: POST http://localhost:3000/webhook
[meta]: More information in the documentation

What do I do now?

You will notice that the bot starts an HTTP service (endpoint) that must be online on a server so that you can connect it with Meta.


Option 1:

You can test locally through a proxy tunnel server.  Download ngork, a free tool that will help with this.


This generates an online URL that we can use in the WebHook section of Meta





Option 2:

If you have already deployed your bot on a server, you need to obtain the public IP or subdomain provided to you. Example if you are using Railway, you can go to the settings section and generate a subdomain. We would then have the WebHook https://base-twilio-memory-production.up.railway.app/twilio-hook



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.