Skip to content

Webhooks Guide ​

Deploy hooks let your application receive real-time HTTP notifications when content changes in your project. Use them to trigger static site rebuilds, sync inventory with external systems, or run custom workflows.

How deploy hooks work ​

  1. You register an endpoint URL and choose a hook type (HTTP or GitHub Actions).
  2. When a matching event occurs, OneFive sends a POST request to your endpoint.
  3. Your endpoint processes the request and returns a 2xx status to acknowledge receipt.

Creating a deploy hook ​

HTTP hook ​

Send a POST to any HTTPS endpoint when your content changes. Works with Vercel, Netlify, Cloudflare Pages, or any custom URL.

bash
curl -X POST https://api.hydrajs.dev/v1/store/deploy-hooks \
  -H "Authorization: Bearer sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Vercel Production",
    "type": "http",
    "url": "https://api.vercel.com/v1/integrations/deploy/prj_...",
    "secret": "optional_bearer_token"
  }'

GitHub Actions hook ​

Trigger a repository_dispatch event on a GitHub repository to start a workflow.

bash
curl -X POST https://api.hydrajs.dev/v1/store/deploy-hooks \
  -H "Authorization: Bearer sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Storefront Rebuild",
    "type": "github_actions",
    "url": "my-org/my-storefront",
    "secret": "ghp_your_personal_access_token",
    "event_type": "rebuild"
  }'

For GitHub Actions hooks, url is owner/repo and secret is a GitHub Personal Access Token with Actions write scope.

Hook options ​

FieldRequiredDescription
nameYesA label for this hook (e.g. "Vercel Production")
typeYeshttp or github_actions
urlYesFull HTTPS URL for http hooks, or owner/repo for GitHub Actions
secretNoBearer token (http) or GitHub PAT (github_actions)
event_typeNoGitHub Actions repository_dispatch event type. Defaults to rebuild.
auto_pause_thresholdNoAuto-pause after N consecutive failures. Defaults to 5. Set to 0 to disable.

Auto-pause on failure ​

If a hook fails consecutively, OneFive automatically pauses it to prevent repeated failures. The default threshold is 5 consecutive failures. You can adjust this per hook or disable it by setting auto_pause_threshold to 0.

Paused hooks stop firing until you manually re-enable them through the admin panel or API.

Testing a hook ​

Trigger a test delivery to verify your endpoint is working:

bash
curl -X POST https://api.hydrajs.dev/v1/store/deploy-hooks/dh_abc123/test \
  -H "Authorization: Bearer sk_your_key"

Managing hooks ​

List, update, and delete hooks through the Deploy Hooks API.

typescript
import { createClient } from '@onefive/hydra'

const hydra = createClient({ apiKey: 'sk_...' })

// List all hooks
const { data: hooks } = await hydra.deployHooks.list()

// Update a hook
await hydra.deployHooks.update('dh_abc123', {
  name: 'Vercel Staging'
})

// Delete a hook
await hydra.deployHooks.delete('dh_abc123')

Best practices ​

  • Use HTTPS endpoints. HTTP URLs are not supported in production.
  • Keep secrets secure. Store webhook secrets in environment variables, not in your codebase.
  • Monitor failures. Check the admin panel for paused hooks and delivery failures.
  • Set appropriate thresholds. If your endpoint has occasional downtime, increase the auto_pause_threshold to avoid premature pausing.