Repository navigation
feat: customer webhooks via @profullstack/webhooks 0.2.1 (0.3.0) - #19
Merged
Merged
Conversation
Advertisers and publishers can register webhook endpoints (/me#webhooks, /api/v1/webhooks behind the an_ API key, `adnetwork webhook ...`, MCP create_webhook etc.) and get signed CloudEvents for their own ads, money and sites: ad.created, ad.started, ad.paused, ad.deleted, budget.exhausted, deposit.completed, deposit.failed, credit.added, site.added, site.verified, site.lost, site.removed, payout.requested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Customer webhooks on @profullstack/webhooks 0.2.1 (pinned exactly; deliveries never follow redirects).
What
AdNetwork.hooks = new Webhooks({ store: sqliteStore(store.db), source: origin, eventTypes: WEBHOOK_EVENTS }), tables in the existing SQLite file.hooks.start()once inserve().hook(sub, type, data, subject): fire-and-forget emit to the account the event is about; never in the way of the action./api/v1/webhooks(list, create, get, test, rotate, deliveries, delete) mounted through the existingan_API-key wrapper, so 401 without a key, owner = the key's account, writes count against the existing write limit./me#webhookscard: list, add (URL + event patterns), send a test, new secret, remove; secret shown once. Endpoints are deleted with the account.adnetwork webhooks,adnetwork webhook add|test|rotate|rm|log. MCP:list_webhooks,create_webhook,test_webhook,rotate_webhook_secret,delete_webhook,webhook_deliveries. Help page + README document them.Events (owner = the advertiser/publisher's CoinPay sub)
ad.createdad:<ref>ad.started/ad.pausedenforce();reason:requested,funded,no_budgetad:<ref>ad.deletedad:<ref>budget.exhaustedaccount:<sub>deposit.completed/deposit.failedfailed, withstatus)deposit:<id>credit.addedkind: code/invite, spend-only)account:<sub>site.added/site.verified/site.removedsite:<host>site.lostsite:<host>payout.requestedsite:<host>The candidate names
ad.approved/ad.rejected/payout.sentfrom the brief do not exist in ad.network: crawlproof has no review step here, and payouts are a single crawlproof call whose answer is recorded aspayout.requestedwith itsstatus(confirmedorrequested).Existing endpoints
None: ad.network sent no outbound webhooks before this, so nothing to migrate and no receiver-visible shape change.
Tests
3 new tests: API auth + per-account scoping + SSRF/event validation; an end-to-end advertiser + publisher run asserting each event's payload and that every delivery verifies against the secret shown on /me (and fails with a wrong one), rotate/remove from the page; CLI + MCP.
bun test26/26,tsc --noEmitclean.🤖 Generated with Claude Code