Spaces:
Build error
Build error
Commit ·
3ff485a
1
Parent(s): acff9d2
Using the spaces secrets for token
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import os
|
|
| 7 |
app = FastAPI()
|
| 8 |
|
| 9 |
# Your WhatsApp verification token
|
| 10 |
-
VERIFY_TOKEN =
|
| 11 |
|
| 12 |
# WhatsApp API credentials
|
| 13 |
WHATSAPP_API_URL = "https://graph.facebook.com/v17.0/YOUR_PHONE_NUMBER_ID/messages"
|
|
@@ -24,7 +24,6 @@ async def verify_webhook(request: Request):
|
|
| 24 |
params.get("hub.verify_token") == VERIFY_TOKEN
|
| 25 |
):
|
| 26 |
return Response(content=params.get("hub.challenge"), media_type="text/plain")
|
| 27 |
-
return JSONResponse(content=params.get("hub.challenge"), status_code=200)
|
| 28 |
else:
|
| 29 |
raise HTTPException(status_code=403, detail="Verification failed")
|
| 30 |
|
|
|
|
| 7 |
app = FastAPI()
|
| 8 |
|
| 9 |
# Your WhatsApp verification token
|
| 10 |
+
VERIFY_TOKEN = os.getenv("WHATSAPP_VERIFY_TOKEN", "your_verification_token")
|
| 11 |
|
| 12 |
# WhatsApp API credentials
|
| 13 |
WHATSAPP_API_URL = "https://graph.facebook.com/v17.0/YOUR_PHONE_NUMBER_ID/messages"
|
|
|
|
| 24 |
params.get("hub.verify_token") == VERIFY_TOKEN
|
| 25 |
):
|
| 26 |
return Response(content=params.get("hub.challenge"), media_type="text/plain")
|
|
|
|
| 27 |
else:
|
| 28 |
raise HTTPException(status_code=403, detail="Verification failed")
|
| 29 |
|