Documentation Index
Fetch the complete documentation index at: https://docs.spn.wtf/llms.txt
Use this file to discover all available pages before exploring further.
Order Drafts
Order drafts are WhatsApp-parsed orders pending review before conversion to real client orders. All routes are prefixed with/order-drafts.
GET /order-drafts
Get all pending order drafts.
Response
GET /order-drafts/{draft_id}
Get a specific order draft with all its entries.
PUT /order-drafts/{draft_id}
Update metadata of an order draft.
DELETE /order-drafts/{draft_id}
Delete an order draft and all its entries.
PUT /order-drafts/{draft_id}/entries/{entry_id}
Update a specific entry within a draft.
Request Body
POST /order-drafts/{draft_id}/recalculate_slip_numbers
Recalculate and reassign slip numbers for all entries in a draft.
POST /order-drafts/{draft_id}/convert
Convert a reviewed draft into actual client orders. Creates real client_order records and deletes the draft.
WhatsApp Webhook
POST /gupshup_incoming_webhook
Receives incoming WhatsApp messages from Gupshup.
Flow:
- Customer sends an order via WhatsApp
- Gupshup forwards the message to this endpoint
- Sender’s phone number is checked against
ALLOWED_PHONE_NUMBERS - If allowed, message is sent to OpenAI for structured parsing
- An
OrderDraftis created with parsed entries - A WhatsApp confirmation reply is sent back
- Staff review the draft at
/order-draftsin the frontend - Once confirmed, draft is converted to real client orders
Khata Upload
Khata upload processes scanned/photographed ledger sheets using OCR.POST /khata-upload
Upload a khata image/PDF and get back parsed entries (v1).
Request: multipart/form-data
| Field | Type | Description |
|---|---|---|
file | file | Image or PDF of the khata page |