{"id":29473439,"url":"https://github.com/android-sms-gateway/example-webhooks-fastapi","last_synced_at":"2025-07-23T12:03:45.409Z","repository":{"id":304473732,"uuid":"966592903","full_name":"android-sms-gateway/example-webhooks-fastapi","owner":"android-sms-gateway","description":"🔐 Example FastAPI webhook processor - demonstrates registration, HMAC validation, and payload handling.","archived":false,"fork":false,"pushed_at":"2025-07-13T09:29:46.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-13T11:33:56.462Z","etag":null,"topics":["api-integration","example","fastapi","python","sms","sms-gate","sms-gateway","webhook"],"latest_commit_sha":null,"homepage":"https://docs.sms-gate.app/features/webhooks/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/android-sms-gateway.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-04-15T06:51:46.000Z","updated_at":"2025-07-13T09:29:47.000Z","dependencies_parsed_at":"2025-07-13T11:33:58.932Z","dependency_job_id":"496ae188-7b15-4d63-8e2f-ce549ee9dadf","html_url":"https://github.com/android-sms-gateway/example-webhooks-fastapi","commit_stats":null,"previous_names":["android-sms-gateway/example-webhooks-fastapi"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/android-sms-gateway/example-webhooks-fastapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-sms-gateway%2Fexample-webhooks-fastapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-sms-gateway%2Fexample-webhooks-fastapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-sms-gateway%2Fexample-webhooks-fastapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-sms-gateway%2Fexample-webhooks-fastapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/android-sms-gateway","download_url":"https://codeload.github.com/android-sms-gateway/example-webhooks-fastapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/android-sms-gateway%2Fexample-webhooks-fastapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265313480,"owners_count":23745190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api-integration","example","fastapi","python","sms","sms-gate","sms-gateway","webhook"],"created_at":"2025-07-14T15:38:49.737Z","updated_at":"2025-07-14T15:38:52.722Z","avatar_url":"https://github.com/android-sms-gateway.png","language":"Python","readme":"# 📱 Example SMS Webhook Processor (FastAPI)\n\n[![Example](https://img.shields.io/badge/Type-Example%20Project-orange.svg)](https://github.com/yourusername/sms-webhook-processor)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Python](https://img.shields.io/badge/Python-3.9%2B-brightgreen.svg)](https://www.python.org/)\n[![FastAPI](https://img.shields.io/badge/Framework-FastAPI-%2300C7B7.svg)](https://fastapi.tiangolo.com/)\n\n\u003e **⚠️ Example Project Notice**  \n\u003e Not intended for production use without proper security review and modifications.\n\n## 📋 Table of Contents\n- [📱 Example SMS Webhook Processor (FastAPI)](#-example-sms-webhook-processor-fastapi)\n  - [📋 Table of Contents](#-table-of-contents)\n  - [✨ About The Project](#-about-the-project)\n    - [🛠️ Built With](#️-built-with)\n    - [⚠️ Important Notes](#️-important-notes)\n  - [🚀 Getting Started](#-getting-started)\n    - [📦 Prerequisites](#-prerequisites)\n    - [⚡ Installation](#-installation)\n  - [⚙️ Configuration](#️-configuration)\n  - [🖥️ Usage](#️-usage)\n  - [📚 API Reference](#-api-reference)\n    - [`POST /webhook/sms-received`](#post-webhooksms-received)\n  - [🤝 Contributing](#-contributing)\n  - [📜 License](#-license)\n\n## ✨ About The Project\n\n**Example Project Features**:\n- 🧩 Demonstrates webhook registration/deregistration lifecycle\n- 🔐 Example HMAC signature validation implementation\n- 📝 Sample payload validation using Pydantic models\n\n### 🛠️ Built With\n\n- 🚀 [FastAPI](https://fastapi.tiangolo.com/) - Modern Python web framework\n- ✔️ [Pydantic](https://pydantic.dev/) - Data validation and settings management\n- 🌐 [HTTPX](https://www.python-httpx.org/) - Async HTTP client\n- ⚡ [UVicorn](https://www.uvicorn.org/) - ASGI server\n\n### ⚠️ Important Notes\n\n**This example intentionally omits**:\n\n- Production-grade error handling\n- Rate limiting\n- Persistent storage integration\n- Advanced security features\n\n**Recommended for**:\n\n- 🧪 Testing SMS Gate webhook integration\n- 🎓 Learning FastAPI webhook implementations\n\n## 🚀 Getting Started\n\n### 📦 Prerequisites\n\n- Python 3.9+ (development environment)\n- Valid SSL certificate ([project's CA](https://docs.sms-gate.app/services/ca/) available) or reverse proxy (like [ngrok](https://ngrok.com/))\n- SMS Gate credentials\n\n### ⚡ Installation\n\n1. Clone the example repository:\n    ```bash\n    git clone https://github.com/android-sms-gateway/example-webhooks-fastapi.git\n    cd example-webhooks-fastapi\n    ```\n\n2. Install development dependencies:\n    ```bash\n    pip install -r requirements.txt\n    # or\n    pipenv install\n    ```\n\n3. Create example environment file:\n    ```bash\n    cp .env.example .env\n    ```\n\n## ⚙️ Configuration\n\n**Example `.env` configuration**:\n```ini\n# 🔑 Example SMS Gate API Credentials\nSMS_GATE_API_URL=\"https://api.sms-gate.app/3rdparty/v1\" # API root endpoint (optional)\nSMS_GATE_API_USERNAME=\"test_user\"                       # API username\nSMS_GATE_API_PASSWORD=\"test_password\"                   # API password\n\n# 🔒 Example Webhook Security\nWEBHOOK_SECRET=\"your_test_secret_here\"                      # signing key (optional)\nWEBHOOK_URL=\"https://localhost:8443/webhook/sms-received\"   # current server endpoint\n\n# 🛡️ SSL Configuration\nSSL_CERT_PATH=\"./certs/server.crt\"  # SSL certificate (optional)\nSSL_KEY_PATH=\"./certs/server.key\"   # SSL private key (optional)\n```\n\n## 🖥️ Usage\n\n**Run the example server**:\n```bash\npython main.py\n```\n\n**Expected output**:\n```plaintext\nINFO:     Started server process [42516]\nINFO:     Waiting for application startup.\nRegistered webhook with ID: mIv93KBZgaFNGrhl_ivk9\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)\nReceived SMS:\nSIM: 1\nFrom: 6505551212\nMessage: Android is always a sweet treat!\nReceived at: 2025-04-15 12:28:01+07:00\nINFO:     169.150.246.92:0 - \"POST /webhook/sms-received HTTP/1.1\" 200 OK\n^CINFO:     Shutting down\nINFO:     Waiting for application shutdown.\nUnregistered webhook ID: mIv93KBZgaFNGrhl_ivk9\nINFO:     Application shutdown complete.\nINFO:     Finished server process [42516]\n```\n\n## 📚 API Reference\n\n### `POST /webhook/sms-received`\n\n**Example Request**:\n```bash\ncurl -X POST https://localhost:8443/webhook/sms-received \\\n  -H \"X-Signature: abc123...\" \\\n  -H \"X-Timestamp: 1690123456\" \\\n  -d @sample_payload.json\n```\n\n**Example Response**:\n```json\n{\n  \"status\": \"ok\"\n}\n```\n\n## 🤝 Contributing\n\nThis example project welcomes contributions to:\n\n- Improve documentation\n- Demonstrate additional features\n- Enhance example security implementations\n\n## 📜 License\n\nThis example code is released under [Apache License 2.0](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroid-sms-gateway%2Fexample-webhooks-fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandroid-sms-gateway%2Fexample-webhooks-fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandroid-sms-gateway%2Fexample-webhooks-fastapi/lists"}