Webhook Components

2 Components

Pre-built, customizable components for managing webhooks and monitoring delivery status. Drop-in UI for webhook configuration and debugging.

Quick Start

All webhook components are available from the SDK. Wrap your app with SylphxProvider for automatic webhook context and API integration.
Installation
import {
  WebhookManager,
  WebhookDeliveryLog,
} from '@sylphx/platform-sdk/react'

WebhookManager

A complete interface for managing webhooks. Users can create new webhooks, edit existing ones, test delivery, and delete webhooks they no longer need. Perfect for settings pages and developer dashboards.

Create
Edit
Delete
Themeable
Basic Usage
import { WebhookManager } from '@sylphx/platform-sdk/react'

export default function SettingsPage() {
  return (
    <div className="max-w-4xl mx-auto py-8">
      <h1 className="text-2xl font-bold mb-6">Webhook Settings</h1>
      <WebhookManager
        onWebhookCreated={(webhook) => {
          console.log('New webhook:', webhook)
          toast.success('Webhook created successfully')
        }}
        onWebhookUpdated={(webhook) => {
          console.log('Updated webhook:', webhook)
          toast.success('Webhook updated')
        }}
        onWebhookDeleted={(webhookId) => {
          console.log('Deleted webhook:', webhookId)
          toast.success('Webhook deleted')
        }}
      />
    </div>
  )
}

Props

PropertyTypeDescription
webhooksWebhook[]Array of webhooks (auto-fetched if not provided)
availableEventsstring[]List of event types users can subscribe to
onWebhookCreated(webhook: Webhook) => voidCallback when a new webhook is created
onWebhookUpdated(webhook: Webhook) => voidCallback when a webhook is updated
onWebhookDeleted(webhookId: string) => voidCallback when a webhook is deleted
onWebhookTested(webhookId: string, result: TestResult) => voidCallback after testing a webhook
onError(error: Error) => voidCallback on any operation error
showTestButtonboolean= trueShow button to test webhook delivery
showSecretFieldboolean= trueShow secret field in create/edit form
showDeliveryLogsboolean= falseShow recent delivery logs for each webhook
allowMultipleboolean= trueAllow creating multiple webhooks
maxWebhooksnumberMaximum number of webhooks allowed
defaultEventsstring[]Pre-selected events for new webhooks
requiredEventsstring[]Events that must be selected
disabledEventsstring[]Events that cannot be selected
validateUrl(url: string) => boolean | stringCustom URL validation function
emptyStateReactNodeCustom empty state when no webhooks exist
variant"default" | "compact" | "card"= "default"Visual style variant
themeThemeVariablesCustom theme overrides
classNamestringAdditional CSS classes

Webhook Object

PropertyTypeDescription
idrequiredstringUnique webhook identifier
urlrequiredstringEndpoint URL for webhook delivery
eventsrequiredstring[]Array of subscribed event types
secretstringHMAC signing secret
enabledboolean= trueWhether the webhook is active
descriptionstringOptional description
createdAtrequiredDateWhen the webhook was created
updatedAtDateWhen the webhook was last updated
lastDeliveryDeliveryStatusStatus of the most recent delivery
metadataRecord<string, unknown>Custom metadata

Advanced Examples

<WebhookManager
  availableEvents={[
    'user.created',
    'user.updated',
    'user.deleted',
    'payment.succeeded',
    'payment.failed',
    'subscription.created',
    'subscription.cancelled',
  ]}
  defaultEvents={['user.created', 'payment.succeeded']}
  requiredEvents={['user.created']}
  disabledEvents={['user.deleted']} // Premium only
  onWebhookCreated={(webhook) => {
    analytics.track('webhook_created', {
      events: webhook.events,
    })
  }}
/>

Webhook Secrets

When showSecretField is enabled, users can set their own signing secret. Otherwise, secrets are automatically generated and managed by the platform.

WebhookDeliveryLog

Display delivery attempts with status indicators, timestamps, response codes, and detailed request/response information. Essential for debugging webhook issues and monitoring delivery health.

Success
Failed
Pending
Retry
Basic Usage
import { WebhookDeliveryLog } from '@sylphx/platform-sdk/react'

export default function WebhookDetailsPage({ params }) {
  return (
    <div className="max-w-4xl mx-auto py-8">
      <h1 className="text-2xl font-bold mb-6">Delivery History</h1>
      <WebhookDeliveryLog
        webhookId={params.webhookId}
        onRetry={(deliveryId) => {
          console.log('Retrying delivery:', deliveryId)
          toast.info('Retrying webhook delivery...')
        }}
        onDeliveryClick={(delivery) => {
          // Show detailed modal
          setSelectedDelivery(delivery)
          setModalOpen(true)
        }}
      />
    </div>
  )
}

Props

PropertyTypeDescription
webhookIdrequiredstringWebhook ID to fetch deliveries for
deliveriesDelivery[]Array of deliveries (auto-fetched if not provided)
onDeliveryClick(delivery: Delivery) => voidCallback when a delivery row is clicked
onRetry(deliveryId: string) => voidCallback when retry button is clicked
onRetryAll() => voidCallback when "Retry All Failed" is clicked
showRetryButtonboolean= trueShow retry button for failed deliveries
showRetryAllButtonboolean= trueShow "Retry All Failed" button
showRequestDetailsboolean= trueShow expandable request/response details
showFiltersboolean= trueShow status filter tabs
showSearchboolean= falseShow event type search
showTimestampsboolean= trueShow relative timestamps
showStatusCodeboolean= trueShow HTTP response status code
showDurationboolean= trueShow request duration
showEventTypeboolean= trueShow event type column
filterByStatus"all" | "success" | "failed" | "pending"Pre-filter by status
filterByEventstringPre-filter by event type
pageSizenumber= 25Number of deliveries per page
infiniteScrollboolean= trueEnable infinite scroll loading
pollIntervalnumber= 0Interval to poll for new deliveries (ms)
emptyStateReactNodeCustom empty state content
loadingStateReactNodeCustom loading state
variant"default" | "compact" | "detailed"= "default"Visual density variant
themeThemeVariablesCustom theme overrides
classNamestringAdditional CSS classes

Delivery Object

PropertyTypeDescription
idrequiredstringUnique delivery identifier
webhookIdrequiredstringAssociated webhook ID
eventIdrequiredstringEvent that triggered this delivery
eventTyperequiredstringType of event (e.g., user.created)
statusrequired"success" | "failed" | "pending"Delivery status
statusCodenumberHTTP response status code
durationnumberRequest duration in milliseconds
attemptrequirednumberAttempt number (1-5)
maxAttemptsnumber= 5Maximum retry attempts
nextRetryAtDateWhen the next retry will occur
errorstringError message if failed
requestHeadersRecord<string, string>Request headers sent
requestBodystringRequest payload (JSON)
responseHeadersRecord<string, string>Response headers received
responseBodystringResponse body received
createdAtrequiredDateWhen the delivery was attempted

Advanced Examples

<WebhookDeliveryLog
  webhookId={webhookId}
  showFilters={true}
  showSearch={true}
  showRetryAllButton={true}
  filterByStatus="failed"
  onRetryAll={async () => {
    await retryAllFailed(webhookId)
    toast.success('Retrying all failed deliveries')
  }}
  onRetry={async (deliveryId) => {
    await retryDelivery(deliveryId)
    toast.info('Retry scheduled')
  }}
/>

Large Payloads

Request and response bodies are truncated after 10KB in the UI. Use the onDeliveryClick callback to fetch and display full payloads in a modal.

Theming

All webhook components support theming via the theme prop. Customize colors, fonts, and spacing to match your brand.

Custom Theme
import { WebhookManager, WebhookDeliveryLog, defaultTheme, type ThemeVariables } from '@sylphx/platform-sdk/react'

const customTheme: ThemeVariables = {
  ...defaultTheme,
  colorPrimary: '#8b5cf6',
  colorPrimaryHover: '#7c3aed',
  colorBackground: '#ffffff',
  colorForeground: '#1f2937',
  colorMuted: '#f3f4f6',
  colorMutedForeground: '#6b7280',
  colorBorder: '#e5e7eb',
  colorSuccess: '#10b981',
  colorError: '#ef4444',
  colorWarning: '#f59e0b',
  fontFamily: 'Inter, sans-serif',
  fontSize: '14px',
  borderRadius: '0.75rem',
}

<WebhookManager theme={customTheme} />
<WebhookDeliveryLog webhookId={id} theme={customTheme} />
PropertyTypeDescription
colorPrimarystring= #000000Primary brand color
colorPrimaryHoverstring= #1f2937Primary color on hover
colorBackgroundstring= #ffffffComponent background
colorForegroundstring= #1f2937Primary text color
colorMutedstring= #f3f4f6Muted background
colorMutedForegroundstring= #6b7280Secondary text color
colorBorderstring= #e5e7ebBorder color
colorSuccessstring= #10b981Success status color
colorErrorstring= #ef4444Error/failed status color
colorWarningstring= #f59e0bWarning/pending status color
fontFamilystring= system-uiFont family
borderRadiusstring= 0.5remBorder radius

Best Practices

Require HTTPS

Use URL validation to enforce HTTPS endpoints. Never allow HTTP webhooks in production.

Show Delivery Status

Display recent delivery status in the webhook list so users can quickly identify issues.

Enable Retry

Allow users to manually retry failed deliveries. Sometimes temporary issues cause failures.

Provide Test Functionality

Let users test their webhook endpoints before relying on them for production events.

Need more customization?

Use the useWebhooks hook for fully custom UI while keeping all the functionality.