- POST /webhook – Receives an incoming message, calls the LLM to parse intent (book / pay / inquire) and generate a reply.
- POST /booking – Mock “confirm booking” endpoint to show a second Lambda and extensibility.
.venv\Scripts\activate
python test_webhook_local.py "I want to book a table for 2 tomorrow at 7pm"sam build
sam local start-api --env-vars env.jsonCreate env.json from env.json.example and set your OPENAI_API_KEY there for local Lambda runs.
Then:
-
Webhook (simulate incoming message)
POST http://127.0.0.1:3000/webhook
Body (JSON):{ "message": "I want to book a table for 2 tomorrow at 7pm" } -
Booking (mock confirm)
POST http://127.0.0.1:3000/booking
Body (JSON):{ "intent": "book", "details": { "guests": 2, "time": "19:00" } }
sam build
sam deploy --guidedFollow the prompts (stack name, region, etc.). After deploy, use the reported API Gateway URL for /webhook and /booking.
For local run, use .env. For deployed Lambdas, set in template.yaml (or use Parameter Store/Secrets Manager):
OPENAI_API_KEY– required for LLM callsOPENAI_BASE_URL– optionalOPENAI_MODEL– optional (default:gpt-4o-mini)