Skip to content

JPierr3/bigdateros-whatsappbot-langchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whatsapp Bot con Python

Impulsa tu negocio con un bot usando las apis oficiales de whatsapp. pueden ver el video paso a paso en el siguiente enlace: https://youtu.be/puYWiZDJnL0

Descarga el proyecto

git clone https://github.com/JPierr3/bigdateros-whatsappbot-python.git

Funcionalidades

  • Enviar mensaje de texto
  • Enviar menus como botones o listas
  • Enviar stickers
  • Marcar los mensajes como "visto" (doble check azul)
  • Reaccionar con emojis los mensajes del usuario
  • Enviar documentos pdf

Para probarlo localmente

  1. Dirigete al directorio donde descargaste el proyecto
  cd bigdateros-whatsappbot-python
  1. Crea un ambiente virtual con la version de python 3.10
  virtualenv -p 3.10.11 .venv
  1. Activa el ambiente virtual
  source .venv/bin/activate
  1. Instala las dependencias
  pip install -r requirements.txt
  1. Corre el aplicativo
  python app.py

Simular mensajes del usuario con postman

Ingresar la URL
http://127.0.0.1:5000/webhook

1. obtener media_id desde whatsapp
   en body, seleccionar "form-data" e ingresar key: messaging_product   y Value: whatsapp
   adicional agregar key: file  y marcarlo como archivo

2. simular mensaje pdf
   en body seleccionar "raw" y marcar tipo JSON
{
  "object": "whatsapp_business_account",
  "entry": [{
      "id": "WHATSAPP_BUSINESS_ACCOUNT_ID",
      "changes": [{
          "value": {
              "messaging_product": "whatsapp",
              "metadata": {
                  "display_phone_number": "PHONE_NUMBER",
                  "phone_number_id": "PHONE_NUMBER_ID"
              },
              "contacts": [{
                  "profile": {
                    "name": "NAME"
                  },
                  "wa_id": "WHATSAPP_ID"
                }],
              "messages": [{
                  "from": "ingresa tu numero",
                  "id": "wamid.ID0",
                  "timestamp": "1689257642",
                  "type": "document",
                  "document": {
                    "filename": "HarryPotter_la_piedra_filosofal.pdf",
                    "mime_type": "application/pdf",
                    "sha256": "IMAGE_HASH",
                    "id": " ingresa id del archivo"
                  }
                }]
          },
          "field": "messages"
        }]
    }]
}


3. simular mensaje texto
   en body seleccionar "raw" y marcar tipo JSON
{
  "object": "whatsapp_business_account",
  "entry": [{
      "id": "WHATSAPP_BUSINESS_ACCOUNT_ID",
      "changes": [{
          "value": {
              "messaging_product": "whatsapp",
              "metadata": {
                  "display_phone_number": "PHONE_NUMBER",
                  "phone_number_id": "PHONE_NUMBER_ID"
              },
              "contacts": [{
                  "profile": {
                    "name": "NAME"
                  },
                  "wa_id": "PHONE_NUMBER"
                }],
              "messages": [{
                  "from": "ingresa tu numero",
                  "id": "wamid.ID7",
                  "timestamp": "1689257642",
                  "text": {
                    "body": "asd?"
                  },
                  "type": "text"
                }]
          },
          "field": "messages"
        }]
  }]
}

About

bigdateros-whatsappbot-langchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages