Skip to content

Feat: Webhooks #1978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 102 commits into
base: feat--table-for-cel-failures
Choose a base branch
from
Open

Conversation

mrkaye97
Copy link
Contributor

@mrkaye97 mrkaye97 commented Jul 10, 2025

Description

Adds support for webhook-as-event, where we allow you to set up a webhook (via UI or API) and we'll handle incoming webhooks and process them as events within Hatchet as if they were published from a Hatchet SDK directly.

Example request to create a webhook:

{
    "sourceName": "STRIPE",
    "name": "stripe-test-webhook",
    "eventKeyExpression": "'stripe:' + input.type",
    "authType": "HMAC",
    "auth": {
        "algorithm": "SHA256",
        "encoding": "HEX",
        "signatureHeaderName": "Stripe-Signature",
        "signingSecret": "whsec_<snip>"
    }
}

To get events sending from Stripe, create a webhook pointing at: /api/v1/stable/tenants/< id >/webhooks/stripe-test-webhook

Misc other things:

  1. On the FE, handled the Stripe / Github cases basically as wrappers of the HMAC auth option, where we pre-populate the fields we know from the Stripe / GH docs with their values instead of making the user fill them in
  2. Used a built-in Echo rate limiting middleware for handling rate limiting - set to 50 base, 100 burst by default 🤷

Type of change

  • New feature (non-breaking change which adds functionality)

TODO:

  • Wire up writes of validation failures into a table in the OLAP DB for monitoring
  • Add struct validation on creation
  • Documentation
  • Populator tests
  • sqlc make nullable cols nullable (pgtype.Text) on insert
  • order by tenant, inserted at on the list query
  • maybe rm index for source name
  • set env var for max webhooks per tenant
  • set up partitioning like we do for other tables
  • implement in-memory rate limiter

FE Screenshots:

Screenshot 2025-07-18 at 5 08 03 PM Screenshot 2025-07-18 at 5 08 23 PM Screenshot 2025-07-18 at 5 08 39 PM

Copy link

vercel bot commented Jul 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hatchet-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 9:59pm
hatchet-v0-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 9:59pm

@@ -134,6 +134,12 @@ type ConfigFileRuntime struct {
// GRPCRateLimit is the rate limit for the grpc server. We count limits separately for the Workflow, Dispatcher and Events services. Workflow and Events service are set to this rate, Dispatcher is 10X this rate. The rate limit is per second, per engine, per api token.
GRPCRateLimit float64 `mapstructure:"grpcRateLimit" json:"grpcRateLimit,omitempty" default:"1000"`

// WebhookRateLimit is the rate limit for webhook endpoints per second, per webhook
WebhookRateLimit float64 `mapstructure:"webhookRateLimit" json:"webhookRateLimit,omitempty" default:"50"`
Copy link
Contributor Author

@mrkaye97 mrkaye97 Jul 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't sure what reasonable values here were, but 50 / 100 RPS seemed okay to start with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant