{"id":50487152,"url":"https://github.com/systemslibrarian/flask-ngrok-webhook-demo","last_synced_at":"2026-06-01T23:04:04.200Z","repository":{"id":305991097,"uuid":"1024619541","full_name":"systemslibrarian/flask-ngrok-webhook-demo","owner":"systemslibrarian","description":"Set up a secure, validated, and logged webhook receiver using Flask, Ngrok, and Postman.","archived":false,"fork":false,"pushed_at":"2025-07-23T02:52:45.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-23T04:18:45.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/systemslibrarian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-23T02:09:26.000Z","updated_at":"2025-07-23T03:15:55.000Z","dependencies_parsed_at":"2025-07-23T04:18:52.129Z","dependency_job_id":"bdc78891-d752-4e27-9eb5-ca423d929708","html_url":"https://github.com/systemslibrarian/flask-ngrok-webhook-demo","commit_stats":null,"previous_names":["systemslibrarian/flask-ngrok-webhook-demo"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/systemslibrarian/flask-ngrok-webhook-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemslibrarian%2Fflask-ngrok-webhook-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemslibrarian%2Fflask-ngrok-webhook-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemslibrarian%2Fflask-ngrok-webhook-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemslibrarian%2Fflask-ngrok-webhook-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/systemslibrarian","download_url":"https://codeload.github.com/systemslibrarian/flask-ngrok-webhook-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemslibrarian%2Fflask-ngrok-webhook-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33797129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-01T23:04:03.426Z","updated_at":"2026-06-01T23:04:04.195Z","avatar_url":"https://github.com/systemslibrarian.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask + Ngrok Webhook Demo\n\nThis project demonstrates how to create a secure Flask webhook endpoint and expose it publicly using [Ngrok](https://ngrok.com/). It includes:\n\n- ✅ JSON payload validation\n- 🔐 Header-based secret key authentication\n- 📝 Logging of webhook events to a `.jsonl` file\n- 🔁 Local development using Ngrok tunnels\n\n---\n\n## 📁 Project Structure\n\u003e Logs are written to `webhook_log.jsonl` at runtime. This file is ignored by Git for privacy. See `webhook_log_example.jsonl` for format reference.\n\n\n```\nflask_ngrok_demo/\n├── app_with_webhook_logging.py       # Main Flask app with webhook endpoint\n├── webhook_log.jsonl                 # Log file for incoming requests\n├── requirements.txt                  # Python dependencies\n├── flask_webhook_complete_guide.pdf # PDF instructions for the full setup\n└── .gitignore                        # Ignore venv and log files\n```\n\n---\n\n## 🚀 Features\n\n- **Webhook Endpoint:** `/webhook` accepts only `POST` requests\n- **Header Authentication:** Requires a custom `X-Webhook-Secret` header\n- **Field Validation:** Checks for required fields: `event`, `user`, `status`\n- **Logging:** Saves all valid payloads to `webhook_log.jsonl`\n\n---\n\n## 🔧 Setup Instructions\n\n### 1. Clone the repository\n\n```bash\ngit clone https://github.com/systemslibrarian/flask-ngrok-webhook-demo.git\ncd flask-ngrok-webhook-demo\n```\n\n### 2. Create \u0026 activate a virtual environment\n\n```bash\npython -m venv venv\nvenv\\Scripts\\activate  # Windows\n# OR\nsource venv/bin/activate  # macOS/Linux\n```\n\n### 3. Install dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n### 4. Start the Flask app\n\n```bash\npython app_with_webhook_logging.py\n```\n\n### 5. Start an Ngrok tunnel\n\n```bash\nngrok http 5000\n```\n\nCopy the HTTPS URL shown by Ngrok (e.g., `https://08ee2615cc86.ngrok-free.app`)\n\n---\n\n## 📬 Testing the Webhook (Postman)\n\n- Method: `POST`\n- URL: `https://\u003cyour-ngrok-subdomain\u003e.ngrok-free.app/webhook`\n- Headers:\n  - `Content-Type: application/json`\n  - `X-Webhook-Secret: 123456789123456789`\n- Body (raw JSON):\n```json\n{\n  \"event\": \"test_event\",\n  \"user\": \"john_doe\",\n  \"status\": \"success\"\n}\n```\n\nYou should receive a 200 OK with:\n```json\n{\n  \"status\": \"received\",\n  \"data\": {\n    \"event\": \"test_event\",\n    \"user\": \"john_doe\",\n    \"status\": \"success\"\n  }\n}\n```\n\n---\n\n## 🛡️ Security Notes\n\n- The `SECRET_KEY` is hardcoded for demo purposes. Use an environment variable or config file for production.\n- All requests must include the correct header to be accepted.\n- Logged data is saved in newline-delimited JSON (`.jsonl`) format.\n\n---\n\n## 📄 PDF Guide Included\n\nThe full step-by-step PDF guide is included as:\n- [`flask_webhook_complete_guide_final_cleaned.pdf`](./flask_webhook_complete_guide_final_cleaned.pdf)\n\n---\n\n## 📬 License\n\nMIT License – feel free to use, modify, and share.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemslibrarian%2Fflask-ngrok-webhook-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsystemslibrarian%2Fflask-ngrok-webhook-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemslibrarian%2Fflask-ngrok-webhook-demo/lists"}