devZenaight commited on
Commit
92fb680
·
verified ·
1 Parent(s): 6c3bf56

Upload 5 files

Browse files
Files changed (1) hide show
  1. main.py +2 -0
main.py CHANGED
@@ -34,6 +34,7 @@ def send_whatsapp_message(wa_id, reply):
34
  }
35
  httpx.post(url, headers=headers, json=payload)
36
 
 
37
  async def receive_update(req: Request):
38
  data = await req.json()
39
  change = data["entry"][0]["changes"][0]["value"]
@@ -69,6 +70,7 @@ async def receive_update(req: Request):
69
  # ANY OTHER TYPE: ignore silently
70
  return JSONResponse({"status": "ignored", "type": msg["type"]})
71
 
 
72
  @app.post("/send")
73
  async def check_token():
74
  token = os.getenv("WHATSAPP_API_TOKEN", "")
 
34
  }
35
  httpx.post(url, headers=headers, json=payload)
36
 
37
+ @app.post("/webhook") # incoming WhatsApp updates
38
  async def receive_update(req: Request):
39
  data = await req.json()
40
  change = data["entry"][0]["changes"][0]["value"]
 
70
  # ANY OTHER TYPE: ignore silently
71
  return JSONResponse({"status": "ignored", "type": msg["type"]})
72
 
73
+ # health-check endpoint for token
74
  @app.post("/send")
75
  async def check_token():
76
  token = os.getenv("WHATSAPP_API_TOKEN", "")