|
3 tuần trước cách đây | |
---|---|---|
.. | ||
.env | 4 tuần trước cách đây | |
README.md | 3 tuần trước cách đây | |
ec2_endpoints.py | 4 tuần trước cách đây | |
ec2_services.py | 4 tuần trước cách đây | |
requirements.txt | 4 tuần trước cách đây | |
webhook_main.py | 4 tuần trước cách đây | |
webhook_utils.py | 4 tuần trước cách đây |
Welcome to the WhatsApp Llama4 Bot ! This bot leverages the power of the Llama 4 APIs to provide intelligent and interactive responses to users via WhatsApp. It supports text, image, and audio interactions, making it a versatile tool for various use cases.
httpx
for making asynchronous HTTP requests to external APIs, ensuring efficient handling of media files.dotenv
to manage environment variables, keeping sensitive information like API keys secure.Please refer below a high-level of architecture which explains the integrations :
First, open the WhatsApp Business Platform Cloud API Get Started Guide and follow the first four steps to:
For the last step, you need to further follow the Sample Callback URL for Webhooks Testing Guide to create a free account on glitch.com to get your webhook's callback URL.
Now open the Meta for Develops Apps page and select the WhatsApp business app and you should be able to copy the curl command (as shown in the App Dashboard - WhatsApp - API Setup - Step 2 below) and run the command on a Terminal to send a test message to your WhatsApp.
Note down the "Temporary access token", "Phone number ID", and "a recipient phone number" in the API Setup page above, which will be used later.
git clone https://github.com/meta-llama/llama-cookbook.git
cd llama-cookbook/end-to-end-use-cases/whatsapp-llama4-bot
Ensure you have Python installed, then run the following command to install the required packages:
pip install -r requirements.txt
Create a .env
file in the project directory and add your API keys and other configuration details as follows:
ACCESS_TOKEN=your_whatsapp_access_token
WHATSAPP_API_URL=your_whatsapp_api_url
TOGETHER_API_KEY=your_llama4_api_key
GROQ_API_KEY=your_groq_api_key
PHONE_NUMBER_ID=your_phone_number_id
On your EC2 instance, run the following command on a Terminal to start the FastAPI server
uvicorn ec2_endpoints:app —host 0.0.0.0 —port 5000
Note: If you use Amazon EC2 as your web server, make sure you have port 5000 added to your EC2 instance's security group's inbound rules.
This project is licensed under the MIT License.
We welcome contributions to enhance the capabilities of this bot. Please feel free to submit issues or pull requests.