Webhook API Delivery

For long-running API operations, responses are delivered via webhook callback instead of blocking the connection. Fire and forget.

How It Works

CONSUMER API call + webhook URL 1. Request OPSALIS Route + Settle 2. Forward API OWNER Long-running process 3. ACK (202 Accepted) 4. Processing... Response Ready Result payload 5. Webhook callback → consumer endpoint WEBHOOK ENDPOINT https://your-app.com/hook

Consumer sends a request with a webhook callback URL. The API owner processes the request asynchronously and delivers the response to the consumer's webhook endpoint.

Why Webhook Delivery?

Not every API call returns in milliseconds. Machine learning inference, batch data processing, report generation — these operations can take seconds or minutes. Holding an HTTP connection open that long is fragile and wasteful.

With Opsalis webhook delivery, the consumer fires a request and immediately gets a 202 Accepted response. When the owner finishes processing, the result is pushed to the consumer's webhook endpoint. No polling, no timeouts, no dropped connections.

Real-world example: a data analytics platform subscribes to a heavy-compute API that generates financial reports. Each report takes 30-60 seconds. With webhook delivery, the platform submits requests and processes results as they arrive — no long-polling infrastructure needed.

Live Demo — Webhook Delivery Flow

Webhook Delivery Test

Click "Run Demo" to submit a request with webhook delivery. You'll see the immediate ACK response and the simulated webhook callback.

Code Samples

curl -X POST https://opsalis.com/api/demo/api/bb-webhook-receiver \
  -H "Content-Type: application/json" \
  -H "X-Consumer-Key: demo-public-key-2026" \
  -d '{
    "action": "generate-report",
    "format": "json",
    "webhook_url": "https://your-app.com/hook"
  }'

# Response: 202 Accepted with request ID
# Webhook callback hits your endpoint when ready
// 1. Submit the request with webhook URL
const response = await fetch('https://opsalis.com/api/demo/api/bb-webhook-receiver', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Consumer-Key': 'demo-public-key-2026'
  },
  body: JSON.stringify({
    action: 'generate-report',
    format: 'json',
    webhook_url: 'https://your-app.com/hook'
  })
});

const ack = await response.json();
console.log('Request accepted:', ack.requestId);

// 2. Your webhook endpoint receives the result
// Express.js example:
app.post('/hook', (req, res) => {
  const result = req.body;
  console.log('Webhook received:', result);
  res.sendStatus(200);
});
import requests

# 1. Submit the request with webhook URL
response = requests.post(
    'https://opsalis.com/api/demo/api/bb-webhook-receiver',
    headers={
        'Content-Type': 'application/json',
        'X-Consumer-Key': 'demo-public-key-2026'
    },
    json={
        'action': 'generate-report',
        'format': 'json',
        'webhook_url': 'https://your-app.com/hook'
    }
)

ack = response.json()
print(f"Request accepted: {ack['requestId']}")

# 2. Your webhook endpoint receives the result
# Flask example:
from flask import Flask, request
app = Flask(__name__)

@app.route('/hook', methods=['POST'])
def webhook():
    result = request.json
    print(f"Webhook received: {result}")
    return '', 200

Self-Host: Configure Webhook Delivery

1

Install Opsalis

Pull the free Docker container onto your own server. No cloud dependency.

docker pull opsalis/control-center:latest
docker run -d --name opsalis -p 3000:3000 opsalis/control-center:latest
2

Register Your API with Webhook Support

In the Opsalis web console, register your API and enable webhook delivery mode for long-running operations.

# In the Opsalis web console:
# 1. Go to APIs → Register New API
# 2. Set endpoint: http://localhost:8080/process
# 3. Enable "Webhook delivery" option
# 4. Set pricing and go live
3

Handle Webhook Callbacks in Your API

When your API finishes processing, POST the result to the consumer's webhook URL included in the original request. Opsalis handles the routing and settlement.

4

Consumer Receives Results

The consumer's webhook endpoint receives the response payload. No polling, no long-lived connections. Settlement happens automatically on-chain.