Skip to content

feat(webhooks): make callback_url callable with the webhook secret so workflows can report status back #912

Closed

Description

@gkhngyk

Description

Every opportunity.sent payload includes a callback_url (server/src/routes/content.js line 597):

callback_url: `${serverUrl}/api/content/${opportunity.id}/status`

which invites the receiving workflow to report progress back. The receiver can't use it:

  • the route is PATCH /api/content/:id/status (line 499), but the payload doesn't say which method to use;
  • it is mounted under /api behind Middleware.decodeToken (server/src/server.js line 583), so it needs a signed-in user's Supabase JWT;
  • it then checks assertOpportunityAccess(id, req.user.id) (line 511).

An automation only has the webhook secret, so it can never mark an opportunity in_progress or done.

Proposed behavior

An external workflow can update an opportunity's status by calling callback_url with the webhook secret it already has.

Suggested approach

  • Add a route mounted before the auth middleware, e.g. POST /webhooks/content/:id/status, that:
    • looks up the opportunity's brand and its active webhook_configs row,
    • compares X-Webhook-Secret with the stored secret (constant-time),
    • accepts the same status values as the existing route,
    • is rate-limited, since it is reachable without a session.
  • Point callback_url at it and add callback_method: "POST" to the payload.
  • Document it in docs/api-reference/webhooks.mdx.
  • Unit-test the secret check (missing, wrong, right) and the status whitelist.

Run yarn test from server/ before opening the PR — see CONTRIBUTING.md.

Activity

  1. added
    enhancement
    help wanted
    content
    integrations
    on Oct 4, 2026
  2. knockknock10 commented on Oct 20, 2026

    @knockknock10
    Contributor

    #1240 addressed!
    Pr Initiated
    Please review it once if everything is correct @gkhngyk .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentenhancementhelp wantedintegrations

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions