Webhooks Integration

Receive real-time notifications about Elenik platform events and actions via secure webhook endpoints.

Introduction to Webhooks

Webhooks allow Elenik to notify your applications about important events without constant polling. They're perfect for integrating platform actions into your workflows.

Pro Tip: Always use HTTPS for webhook URLs and verify request signatures.

Getting Started

To configure webhooks, you'll need to register a URL through the Elenik Dashboard that will receive events.

// Set up webhook endpoint in dashboard
POST /api/webhooks
{
  "url": "https://yourapp.com/webhook",
  "events": ["task_complete", "subscription_paid"]
}
Try This Example

Webhook Configuration

Webhooks can be created, updated, or deleted via the Developers Dashboard. You can also use our API to manage subscriptions.

Dashboard

Visual interface for managing subscriptions

REST API

Programmatic management of webhook endpoints

CLI

Command line interface for quick setup

Supported Event Types

Event Type Description
task_complete Triggered when an automated workflow finishes execution
payment_verified Sent after subscription payments are confirmed
user_signup Triggers when new users create an account

Webhook Payload

                        
                        {
                          "event": "task_complete",
                          "data": {
                            "task_id": "abc123",
                            "status": "completed",
                            "created_at": 1689824400
                          },
                          "signature": "HMAC_SHA256_SIGNATURE"
                        }
                        
                    

Secure Webhooks

Signature Verification

All requests include a signature header for authenticity checks

HTTPS Requirement

Only HTTPS endpoints are accepted for registration

Code Examples

Python Flask Example

import flask
from flask import request
import hmac
import hashlib

app = flask.Flask(__name__)

@app.route('/webhook', methods=['POST'])
def webhook():
    payload = request.data
    signature_received = request.headers.get('X-Elenik-Signature')
    
    # Verify signature
    secret = 'your_webhook_secret'
    mac = hmac.new(secret.encode(), msg=payload, digestmod=hashlib.sha256)
    if not hmac.compare_digest(signature_received, mac.hexdigest()):
        return 'Invalid signature', 401
        
    # Process payload
    data = request.json
    print(f"Received event: {data['event']}")
    
    return 'OK', 200

Sample Payload

{
  "event": "payment_verified",
  "data": {
    "user_id": "u_123",
    "amount": 49.99,
    "currency": "USD"
  },
  "headers": {
    "X-Elenik-Signature": "sha256=abc123..."
  }
}