Quick Start

1. Configure Webhook Endpoint

Set up an endpoint to receive event webhooks:
const express = require('express');
const app = express();

app.use(express.json());

app.post('/webhook/events', (req, res) => {
  const event = req.body;
  
  console.log('Received event:', event.event);
  console.log('Token:', event.token.symbol);
  
  // Process the event
  handleEvent(event);
  
  // Always respond with 200 OK
  res.status(200).send('OK');
});

app.listen(3000, () => {
  console.log('Webhook server running on port 3000');
});

2. Register Your Webhook

Contact Dialect to register your webhook endpoint and configure event types:
  • Endpoint URL: https://your-domain.com/webhook/events
  • Event Types: Price change events
  • Token List: Specify which tokens to monitor (or use defaults)

3. Handle Events

Implement event handlers based on the event type:
function handleEvent(event) {
  switch (event.event) {
    case 'token_price_change':
      handlePriceChangeEvent(event);
      break;
    default:
      console.log('Unknown event type:', event.event);
  }
}

Price Change Events

Price change events are triggered by significant price movements over sliding time windows using percentage change thresholds.
async function handlePriceChangeEvent(event) {
  const { token, change, trigger } = event;
  
  // Example: Notify users who hold this token
  const message = `${token.symbol} moved ${change.percentage_change.toFixed(1)}% over the last ${trigger.window.duration}`;
  
  // Send notifications based on your application logic
  await notifyUsers(token.address, message);
}

Available Windows

  • 1h, 3h, 6h, 12h, 24h, 7d

Spam Prevention

Dialect’s event detection includes built-in capabilities to ensure users don’t receive too many alerts:
  • Debouncing & rolling averages - Prevents rapid-fire alerts
  • Rate limits - Controls notification frequency
  • Priority conflicts - Manages competing events
  • Alert escalation - Prioritizes important events
We’re developing advanced event detection for newly launched tokens that meet specific safety and quality criteria. This system will focus on tokens with “staying power” rather than short-lived movements. Learn more about our approach: See the Trending Tokens Events section for detailed information about detection criteria, safety filters, and the quality-first methodology.
Early Access AvailableTrending token events are in development. The system is being tested internally with smart defaults before expanding to user customization.Contact us for early access or to discuss specific requirements.

Security and Verification

Webhook Signature Verification

Verify webhook authenticity:
const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
    
  return crypto.timingSafeEqual(
    Buffer.from(signature, 'hex'),
    Buffer.from(expectedSignature, 'hex')
  );
}

Error Handling

Return appropriate status codes for reliable webhook delivery:
app.post('/webhook/events', async (req, res) => {
  try {
    await handleEvent(req.body);
    res.status(200).send('OK');
  } catch (error) {
    // Return 500 for temporary errors to trigger retries
    // Return 200 for permanent errors to avoid retries
    const statusCode = error.isTemporary ? 500 : 200;
    res.status(statusCode).send(error.message);
  }
});

Testing

Test your webhook implementation:
const testEvent = {
  event: 'token_price_change',
  timestamp: new Date().toISOString(),
  token: {
    symbol: 'SOL',
    address: 'So11111111111111111111111111111111111111112'
  },
  trigger: {
    type: 'sliding_window_percentage_change',
    window: { duration: '24h' },
    threshold_percentage: 10.0
  },
  change: {
    direction: 'up',
    from: { timestamp: '2025-07-03T14:30:00Z', value: 154.25 },
    to: { timestamp: '2025-07-04T14:30:00Z', value: 171.85 },
    absolute_change: 17.6,
    percentage_change: 11.42
  }
};