creatawebhoodforabusiness
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v7View latest version
A webhook system for handling order notifications in your business. This system can receive order events from e-commerce platforms, payment processors, or other systems and send appropriate notifications.
- Webhook Receiver: Secure endpoint to receive order notifications
- Order Processing: Validates and processes order data
- Email Notifications: Sends order confirmations to customers and business
- Database Storage: Stores order history for tracking
- Security: Validates webhook signatures for security
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Database schema setup
│ │ └── queries.ts # Order database operations
│ ├── routes/
│ │ ├── webhook.ts # Webhook endpoint handler
│ │ └── orders.ts # Order management API
│ └── index.ts # Main server entry point
├── shared/
│ └── types.ts # Shared TypeScript types
└── README.md
-
Set environment variables:
WEBHOOK_SECRET: Secret key for validating webhook signaturesBUSINESS_EMAIL: Email address to receive order notifications
-
The webhook endpoint will be available at:
/webhook/orders
Send POST requests to the webhook endpoint with order data. The system will:
- Validate the webhook signature
- Process the order data
- Store the order in the database
- Send email notifications
- Return a success response
The webhook expects order data in this format:
{ "orderId": "ORD-12345", "customerEmail": "customer@example.com", "customerName": "John Doe", "items": [ { "name": "Product Name", "quantity": 2, "price": 29.99 } ], "total": 59.98, "status": "paid", "timestamp": "2024-01-15T10:30:00Z" }