Detected country: US
logo
Sign InBook a Demo
GuideRecipesDeveloper

Developer Docs

  • Developer foundations
    • How do I authenticate with the Ballet API?
    • How do I connect to Ballet's MCP endpoint?
    • How do I run a playbook over the REST API?
    • How do I stream playbook run events?
    • How do I trigger and react to playbooks with webhooks?
    • How do I wake a suspended run with reply or resume?
  • How do I use Ballet playbooks in an agent framework?
    • How do I call Ballet playbooks from Google ADK?
    • How do I call Ballet playbooks from LangChain?
    • How do I call Ballet playbooks from Mastra?
    • How do I call Ballet playbooks from Pydantic AI?
    • How do I call Ballet playbooks from the Vercel AI SDK?
  • How do playbooks connect to external systems?
    • How do I call external APIs and SDKs from a playbook?
    • How do I connect external MCP servers to playbooks?
    • How do I use secrets and env vars in steps?
  • Introduction
Loading…
logo

Powered by

How do I trigger and react to playbooks with webhooks?

TL;DR: A Webhook trigger gives a playbook a unique HTTP endpoint. External systems POST to that URL to start a run, and the request body is available to the playbook's steps as input. Use webhooks to start playbooks from services that emit outbound events, and use the runs stream to react when a run finishes.

Who this is for

Developers connecting Ballet to systems that emit outbound webhooks (helpdesks, CRMs, CI, payment processors).

How do I trigger a playbook from an external event?

  1. Open the playbook and add a Webhook trigger in the Trigger panel.
  2. Choose a provider when prompted (Zendesk, Freshdesk, ServiceNow, Salesforce, Genesys Cloud, or custom).
  3. Copy the generated endpoint URL and store the provider secret in Secrets.
  4. Register that URL as an outbound webhook in your external system.
  5. When the system fires the event, it POSTs to the URL and starts a run; the payload is passed to the playbook as input.
curl https://api.ballet.dev/api/webhooks/<your-webhook-path> \
  -H "Content-Type: application/json" \
  -d '{ "ticketId": "123", "subject": "Refund request" }'

Configure the exact endpoint from the playbook's Trigger panel — it is unique per playbook. Webhook endpoints are served from api.ballet.dev, not app.ballet.dev.

Provider setup guides

For admin-facing steps in each system, use these Connecting Tools guides:

  • How do I connect CRM and support tools? (index)
  • Salesforce — Flow HTTP callout (inbound) and Connected App (outbound pull)
  • Zendesk
  • HubSpot
  • ServiceNow
  • Genesys Cloud

How is this different from the REST execute endpoint?

For your own backend or CI, prefer the authenticated REST execute endpoint.

How do I react when a run finishes?

Subscribe to GET /api/playbooks/:id/runs/stream and watch for the run_stop event, which carries success and output. This lets an external observer act on completion without being the caller that started the run. See Stream run events.

Tips

  • Test with a manual trigger and a sample payload before enabling the live webhook.
  • Validate and normalize the incoming payload in an early Code step — external systems vary.
  • Keep secrets (for callbacks to the source system) in Secrets, not in the playbook body.

Related articles

  • What triggers can start a playbook?
  • Run playbooks over the REST API
  • Stream run events
  • Connecting to external systems
  • How do I connect CRM and support tools?