Skip to content

Commit fef5f99

Browse files
committed
fix 4
1 parent e720e74 commit fef5f99

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PHONE_NUMBER_ID="541512989046046"
1111
VERIFY_TOKEN="Vedantwabotproject"
1212

1313
# CALLBACK_URL="https://totally-harmless-slug.ngrok-free.app/"
14-
CALLBACK_URL="https://be-project-586951552789.us-central1.run.app/"
14+
CALLBACK_URL="https://be-project-586951552789.us-central1.run.app/webhook"
1515

1616

1717

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,36 @@ chmod +x scripts/*.sh
201201
./scripts/start.sh
202202
```
203203

204+
## 🔧 Troubleshooting
205+
206+
### WhatsApp Webhook Configuration
207+
208+
If you're seeing "POST 405 Method Not Allowed" errors in your logs, this usually means:
209+
210+
1. **Webhook URL Configuration**: Make sure your WhatsApp webhook URL is set to:
211+
- **Correct**: `https://your-domain.com/webhook`
212+
- **Incorrect**: `https://your-domain.com/` (root path)
213+
214+
2. **Environment Variables**: Ensure your `CALLBACK_URL` in the `.env` file matches exactly what you configured in Facebook/WhatsApp Business:
215+
```env
216+
CALLBACK_URL=https://your-domain.com/webhook
217+
```
218+
219+
3. **Facebook Configuration**: In your Facebook App settings under WhatsApp > Configuration, set:
220+
- **Webhook URL**: `https://your-domain.com/webhook`
221+
- **Verify Token**: Must match your `VERIFY_TOKEN` environment variable
222+
223+
### Common Issues
224+
225+
- **Container fails to start**: Check that all required environment variables are set
226+
- **WhatsApp not responding**: Verify webhook URL and verify token match Facebook configuration
227+
- **Model loading errors**: Ensure the model file exists in `assets/models/`
228+
229+
### Health Check Endpoints
230+
231+
- `GET /health` - Basic health check
232+
- `GET /health/detailed` - Detailed component status
233+
204234
---
205235

206236
**Note**: This bot is designed for educational and agricultural support purposes. Always consult with agricultural experts for critical crop decisions.

app/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async def startup_event():
6666
except Exception as e:
6767
print(f"⚠️ WhatsApp service startup error: {e}")
6868

69-
@app.get("/")
69+
@app.get("/health")
7070
async def health_check():
7171
"""Health check endpoint."""
7272
whatsapp_status = False
@@ -81,7 +81,7 @@ async def health_check():
8181
"whatsapp_initialized": whatsapp_status
8282
}
8383

84-
@app.get("/health")
84+
@app.get("/health/detailed")
8585
async def detailed_health_check():
8686
"""Detailed health check endpoint."""
8787
components = {

app/services/whatsapp_bot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def _ensure_whatsapp_initialized(self) -> bool:
5151
return False
5252

5353
try:
54+
logging.info(f"Initializing WhatsApp with callback URL: {self.settings.CALLBACK_URL}")
5455
self.wa = WhatsApp(
5556
phone_id=self.settings.PHONE_NUMBER_ID,
5657
token=self.settings.ACCESS_TOKEN_LTM,

0 commit comments

Comments
 (0)