| Purpose | URL |
|---|---|
| Swagger UI | http://localhost:8000/docs |
| Health | GET /health |
| Webhook verify + events | GET / POST /webhook |
| Webhook event log (DB) | GET /webhook/events |
| Instagram API proxy | /instagram/... |
| Local comment store | /comments/... |
Meta requires a public HTTPS URL. Examples:
# Cloudflare quick tunnel
cloudflared tunnel --url http://localhost:8000
# ngrok
ngrok http 8000In Meta for Developers → your app → Webhooks → Instagram:
- Callback URL:
https://<tunnel-host>/webhook - Verify token: must match
META_WEBHOOK_VERIFY_TOKENin.env
Subscribe to fields such as mentions and comments for your connected Instagram professional account.
- Owned media —
GET /instagram/media/{id}, comments, insights require the media to belong toINSTAGRAM_USER_ID. - Hashtag results —
GET /instagram/hashtag/{tag}/recentand/topuse a reducedfieldsset (see code / Meta limits). - Business Discovery —
GET /instagram/user/by-username/{username}usesbusiness_discovery.username(handle){...}. - Mention listing — Graph does not support
GET /{ig-user}/mentions; use webhooks +GET /instagram/user/{id}/mentioned_media/{media_id}.
SQLite file meta_webhooks.db (default) stores webhook events and tracked comments. Do not commit it (see .gitignore).