Skip to content

Commit

Permalink
added webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderGi committed Feb 28, 2024
1 parent a3bf5e7 commit 8025f7c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion routers/facebook_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,21 @@ def fb_connect_whatsapp_redirect(request: Request):
"pin": settings.WHATSAPP_2FA_PIN,
},
)
print(r.json())
r.raise_for_status()

# subscript our app to weebhooks for WABA
r = requests.post(
f"https://graph.facebook.com/v19.0/{waba_id}/subscribed_apps?access_token={user_access_token}",
json={
"override_callback_uri": (
furl(settings.APP_BASE_URL)
/ router.url_path_for(fb_webhook.__name__)
).tostr(),
"verify_token": settings.FB_WEBHOOK_TOKEN,
},
)
r.raise_for_status()

return HTMLResponse(
f"Sucessfully Connected to whatsapp! You may now close this page."
)
Expand Down

0 comments on commit 8025f7c

Please sign in to comment.