Skip to content

lipskiyp/WhatsAppBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp API Bot (In Progress)

WhatsApp API Bot with a Flask server, launched using ngrok.

The server can currently handle:

  • Initial webhook configuration and token verification with Meta.
  • Incoming messages - server marks the incoming message as "read" and responds with a default greeting text message.
  • Prints status updates for sent messages (e.g. "delivered", "read" etc.)

The app requires the following variables to be stored inside the environment for it to work:

  • WHATSAPP_TOKEN - (temporary) Meta access token (can be found inside the "API Set Up" section on the Meta for Developers website).
  • VERIFY_TOKEN - your own verification token to be used for the webhook configuration (can be any string).
  • GRAPH_BASE_API - base API url (currently version 17 is used - https://graph.facebook.com/v17.0/).
  • PHONE_NUMBER_ID - your sender WhatsApp phone number id.

main.py

Flask main app with all of the server endpoints.

/helpers/verify_webhook.py

Handles the initial webhook set up and token verification logic for GET requests to /mywebhook endpoint.

/helpers/handle_webhook.py

Handles webhook notifications for POST requests to /mywebhook endpoint.

/helpers/handle_messages.py

Handles logic for text messages.

About

WhatsApp API Bot with a Flask server.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages