Skip to content

Latest commit

 

History

History
281 lines (183 loc) · 9.68 KB

Readme.md

File metadata and controls

281 lines (183 loc) · 9.68 KB

Node.js Bot Whatsapp business API Cloud

Npm WhatsApp NodeJS Meta

OpenSource Free MultiLanguage BusinessChat

English documentation

🚀 You will take your business to the next level by providing a 100% professional and automated service hosted in the cloud thanks to fly.io and you will be able to connect to the database with the Supabase service in postgres SQL.

Getting started

The functions of the bot are:

✅ Respond and process

  • Text message.

  • Images.

  • Files.

  • Videos.

  • Locations.

  • Stickers.

  • Contacts.

✅ Send

  • Text messages.

  • Lists.

  • Buttons.

  • Contacts.

  • Audios.

  • Localitations.

  • Stickers.

  • Images.

  • Files.

  • Videos.

Send a list of products of the business with the price.

Respond with the user name of client.

Client Can buy in WhatsApp.

Save the data in Supabase or another database provide server with support Postgres SQL.

Support multilanguage, no limit or restriction

🕞 More functions be added in the future...

Not support for the moment the api:

❌ Send group messages

❌ Administrate member of groups

❌ Send poll to user or group

Get Started

Clone the repository:

git clone https://github.com/TomasS-R/chatbotWhatsAppApiBusiness.git

Install the requirements:

npm install

Security and Env configuration:

The Bot has a env file (ExampleEnv.txt) for protect the keys of the api cloud and supabase service.

⚠️Important⚠️:

You need to modify the name of the file ExampleEnv to .env Please check this out.

In this file you must fill in the corresponding fields by connecting to the server, in my case I used fly.io and to set the keys I used the command:

fly secrets set SUPER_SECRET_KEY=password1234

SUPER_SECRET_KEY = your secret key or the key the service provide you.

password1234 = your password or the password the service provide you.

ℹ️ You can see more information of env configurations of fly.io in his page:

Fly.io

Configure connection to Meta api cloud business 🦾

In this module we will see how to configure the access and interaction with the meta service and the bot so that they can work correctly.

TOKEN=

MetaDevelopersToken

You can obtain this Permanent Token in the developers page of meta and you can configure the AccessToken in webhook option:

Meta for developers account > My applications > WhatsApp > Configuration.

ACCESSTOKEN=

MetaDevelopersAccessToken

The Access Token is generated so that meta can check the correct connection with the bot, you can place it randomly, either with:

  • Numbers

  • Letters

  • Upper and lower case

The URL that requests us meta is the one of our server in which our bot is hosted, once the url and the AccessToken are valid it confirms it and the connection is established.

IDPHONE=

MetaDevelopersAccessToken

You can obtain the IDPHONE in the developers page of meta:

Meta for developers account > My applications > WhatsApp > First Steps.

🤖 The connection is now successfully established between your bot and the server ✅.

More documentation of the proyect in gitbook

Español documentacion

🚀 Llevarás tu negocio al siguiente nivel prestando un servicio 100% profesional y automatizado alojado en la nube gracias a fly.io y podrás conectarte a la base de datos con el servicio Supabase en postgres SQL.

Primeros pasos

Funciones del bot:

✅ Respuestas y procesos

  • Mensajes de texto.

  • Imagenes.

  • Archivos.

  • Videos.

  • Localizaciones.

  • Stickers.

  • Contactos.

✅ Envios

  • Mensajes de texto.

  • Listas.

  • Butones.

  • Contactos.

  • Audios.

  • Localizaciones.

  • Stickers.

  • Imagenes.

  • Archivos.

  • Videos.

Enviar una lista de productos de la empresa con el precio.

Responder con el nombre de usuario del cliente.

El cliente puede comprar en WhatsApp.

Guarde los datos en Supabase o en otra base de datos que proporcione un servidor con soporte en Postgres SQL.

Soporta multilenguaje, sin limite o restriccion

🕞 Mas funciones seran añadidas en el futuro...

No soportado por la api:

❌ Enviar mensajes a grupos

❌ Administrar miembros de grupos

❌ Envia una encuesta al usuario o grupo

Comenzar

Clonar el repositorio:

git clone https://github.com/TomasS-R/chatbotWhatsAppApiBusiness.git

Instalar los requerimientos:

npm install

Seguridad y Entornos de desarrollo:

El bot tiene un archivo env (ExampleEnv.txt) para proteger las claves de la api cloud y el servicio de supabase.

⚠️Importante⚠️:

Debes modificar el nombre del archivo ExampleEnv a .env Por favor revisa esto.

En este archivo IEn este archivo debes rellenar los campos correspondientes conectándote al servidor, en mi caso utilicé fly.io y para establecer las claves utilicé el comando:

fly secrets set SUPER_SECRET_KEY=password1234

SUPER_SECRET_KEY = tu clave secreta o la clave que te provee tu servicio.

password1234 = Tu contraseña o la contraseña que te provee tu servicio.

ℹ️ Puedes ver mas informacion sobre las configuraciones de env de fly.io en su web:

Fly.io

Configure la conexión con la api de Meta api cloud business 🦾

En este módulo veremos cómo configurar el acceso y la interacción con el meta servicio y el bot para que funcionen correctamente.

TOKEN=

MetaDevelopersToken

Puedes obtener este Token permanente en la página de desarrolladores de meta y puedes configurar el AccessToken en la opción webhook:

Meta para desarrolladores cuenta > Mis aplicaciones > WhatsApp > Configuración.

ACCESSTOKEN=

MetaDevelopersAccessToken

El Access Token se genera para que Meta pueda comprobar la correcta conexión con el bot, puedes colocarlo aleatoriamente, ya sea con:

  • Numeros

  • Letras

  • Mayusculas y minusculas

La URL que nos solicita meta es la de nuestro servidor en el que está alojado nuestro bot, una vez la url y el AccessToken son válidos lo confirma y se establece la conexión.

IDPHONE=

MetaDevelopersAccessToken

Puedes obtener el IDPHONE en la página de desarrolladores de meta:

Meta para desarrolladores cuenta > Mis aplicaciones > WhatsApp > Primeros pasos.

🤖 La conexión se ha establecido correctamente entre tu bot y el servidor ✅.

Mas documentacion del proyecto en gitbook