-
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies
pip install -r requirements.txt
-
Run with Uvicorn
uvicorn main:app --host 0.0.0.0 --port 8000
-
Expose with Ngrok
ngrok http 8000
-
Test the SMS Webhook
You can test the webhook by sending a POST request to the
/sms-webhook/
endpoint with a form field namedBody
.curl -X POST http://localhost:8000/sms-webhook/ -d "Body=Hello"
This is the backend for a self-hosted SMS server (kind of like our own Twilio) which will connect and make all database actions on Supabase later on.
user= password= host= port= dbname= ip=
from fastapi import FastAPI, Form
app = FastAPI()
@app.post("/sms-webhook/")
async def receive_sms(Body: str = Form(...)):
print(f"Received SMS: {Body}")
return {"status": "SMS received"}