webhooks.title

webhooks.intro

webhooks.title

webhooks.intro

webhooks.step1_title

webhooks.step1_desc

  • webhooks.step1_secret
  • webhooks.step1_challenge
POST /v1/chains/{chainId}/callbacks
{
  "url": "https://votre-api.com/webhook",
  "name": "Serveur Production"
}

webhooks.step2_title

webhooks.step2_desc

webhooks.step2_action
GET https://votre-api.com/webhook?check=true
webhooks.step2_response
{
  "challenge": "tomato"
}

webhooks.step3_title

webhooks.step3_desc

{
  "event": "block.added",
  "idempotency_key": "uuid-v4",
  "block": {
    "hash": "e3b0c442...",
    "data": { ... }
  }
}

webhooks.security_title

webhooks.security_desc

  • webhooks.security_headers.signature
  • webhooks.security_headers.secret

webhooks.security_verification

// Exemple Node.js / Express
const crypto = require('crypto');

app.post('/webhook', (req, res) => {
  const signature = req.headers['x-callback-signature'];
  const secret = process.env.SOWASIT_WEBHOOK_SECRET;
  
  // Recalcul du HMAC avec le body brut (raw body)
  const hmac = crypto.createHmac('sha256', secret);
  const digest = hmac.update(JSON.stringify(req.body)).digest('hex');
  
  if (signature !== digest) {
    return res.status(401).send('Invalid signature');
  }
  
  // Traitement...
  res.status(200).send('OK');
});
webhooks.idempotency_label : webhooks.idempotency_desc

webhooks.debugging_label

webhooks.debugging_desc