What are Webhooks?
Webhooks are HTTP endpoints that allow external services to send events to your agent. When something happens in an external system (like a payment completing or an order shipping), that system can notify your agent in real-time.Think of it as:
A phone number for your agent - external services can “call” it when events happen
New in v3.0.0: Built-in webhook support for seamless external integrations.
Why Webhooks?
Real-Time Events
Get notified instantly when events happen in external systems
Automated Actions
Automatically respond to external events without user interaction
Seamless Integration
Connect with Stripe, Shopify, GitHub, and any webhook-enabled service
Event-Driven
Build reactive agents that respond to real-world events
How Webhooks Work
1
External Event Occurs
Something happens: payment completes, order ships, PR merges, etc.
2
Service Sends HTTP Request
The external service (Stripe, Shopify) sends a POST request to your webhook URL
3
Your Webhook Receives Event
Your LuaWebhook’s execute function is called with the event data
4
Your Code Takes Action
Process the event: update orders, notify users, trigger jobs, etc.
5
Return Response
Return acknowledgment to the external service
Simple Example
Common Use Cases
- Payments
- E-commerce
- Development
- Custom
Stripe, PayPal, SquareHandle payment events:
- Payment succeeded
- Payment failed
- Refund processed
- Subscription updated
- Update order status
- Notify customer
- Trigger fulfillment
Adding Webhooks to Your Agent
Webhooks are added to your LuaAgent configuration:Webhook URLs
After deploying, you can call webhooks by ID or by name:agentIdis your agent identifier (e.g.,agent_abc123)webhookIdis the UUID shown when the webhook is createdwebhook-nameis the friendly name from your codelua push webhookprints both links
Best Practices
✅ Store User IDs in Metadata
✅ Store User IDs in Metadata
Always include user ID in payment/order metadataWhen creating payments or orders, store the Lua user ID:Then in your webhook, retrieve the specific user:
✅ Handle Errors Gracefully
✅ Handle Errors Gracefully
Don’t throw errors - return error status
✅ Return Quickly
✅ Return Quickly
Webhooks should respond within 5 secondsFor long-running work, queue a job:

