Webhook/Callbacks

Fusior supports real-time webhook delivery for users and developers who want to receive high-priority Twitter signals and insights as they happen. This allows seamless integration into trading bots, analytics dashboards, notification systems, or custom alert workflows.


Webhook Setup

To start receiving alerts:

  1. Navigate to console.fusior.ai/webhooks

  2. Enter your HTTPS-compatible Webhook URL

  3. Save the configuration

Webhooks will be triggered every time Fusior detects a significant signal or event.


Payload Format

Every webhook payload follows a structured format to ensure compatibility and clarity. Below is an example payload:

{
  "tldr": "Demo summary text: this is just placeholder content.",
  "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum vestibulum.",
  "clusterID": "demo-cluster-id",
  "sourceInfo": {
    "handle": "@demo_handle",
    "name": "Demo Source",
    "referenceInfo": {
      "referencedContentId": null,
      "referencedUserHandle": null,
      "referenceType": "Original"
    }
  },
  "report": {
    "signal": "Demo signal description goes here.",
    "type": "DemoType",
    "sourceType": "DemoSource",
    "credibility": "High",
    "riskLevel": "N/A",
    "timing": "DemoTiming",
    "timestamp": "2025-01-01T00:00:00Z",
    "confidenceScore": "N/A",
    "narrativeCategory": "DemoCategory",
    "tokenPotential": "None",
    "engagementMetrics": "0 views, 0 likes, 0 retweets, 0 replies"
  },
  "contextLinking": {
    "context": "Demo context linking text that explains the placeholder scenario.",
    "referenceId": "demo-context-id",
    "historicalPattern": "Demo historical pattern description."
  },
  "momentum": {
    "memeEnergy": "None",
    "viralCoefficient": "0"
  },
  "actionFocus": {
    "track": ["demo_metric_1", "demo_metric_2"],
    "monitor": ["demo_event_1", "demo_event_2"]
  },
  "forecast": "This is a demo forecast: no real predictions here.",
  "finalVerdict": {
    "status": "DemoStatus",
    "actionSummary": "This is a demo action summary.",
    "confidenceRationale": "Demo confidence rationale."
  },
  "tweet_id": "0000000000000000000"
}

Webhook Security

All incoming webhook requests from Fusior include a X-Fusior-Signature header. This is an HMAC SHA-256 hash of the sorted JSON payload using your saved webhook secret.

Always verify this signature to ensure the request was sent by Fusior.


Signature Verification Examples

Python (Flask)

import hashlib
import hmac
import json
from flask import request

def verify_webhook_signature(payload, signature, webhook_secret):
    try:
        payload_str = json.dumps(payload, sort_keys=True)
        expected_signature = hmac.new(
            key=webhook_secret.encode(),
            msg=payload_str.encode(),
            digestmod=hashlib.sha256
        ).hexdigest()
        return hmac.compare_digest(signature, expected_signature)
    except Exception:
        return False

@app.route('/webhook', methods=['POST'])
def handle_webhook():
    signature = request.headers.get('X-Fusior-Signature')
    if not signature:
        return 'Missing signature', 401

    webhook_secret = 'your_webhook_secret'
    payload = request.json

    if not verify_webhook_signature(payload, signature, webhook_secret):
        return 'Invalid signature', 401

    print('Verified webhook payload:', payload)
    return 'OK', 200

Node.js (Express)

app.post('/webhook', (req, res) => {
  const signature = req.headers['x-fusior-signature']
  if (!signature) return res.status(401).send('Missing signature')

  const webhookSecret = 'your_webhook_secret'

  if (!verifyWebhookSignature(req.body, signature, webhookSecret)) {
    return res.status(401).send('Invalid signature')
  }

  // Verified payload
  res.send('OK')
})

Last updated