Currently Available: Need a skilled Software Developer for your next project?
Categories
APIs

Changing a Webhook URL Without Losing Events

When you move a webhook receiver to a new URL, the provider’s subscription controls where it sends events and when it applies the change. That subscription is the provider’s setup for sending selected event messages to a callback URL, the address that receives them. When you update that address, the provider changes how it delivers events, and a successful save alone does not prove that your new receiver gets every expected event.

Before you touch the subscription, get the new receiver ready. Then check how the provider validates the new URL, when it activates the change, and how it handles deliveries already in progress. The provider decides whether it can send events to both the old and new URLs at the same time and whether it lets you resend missed notifications. Watch the cutover closely and compare delivery records, because you cannot assume each event will arrive exactly once.

Verify how the provider changes a URL

Start by reading the documentation for your specific provider, product, subscription type, and update method. Some providers let you edit an existing subscription in place, while others let you create a second subscription or shift traffic in stages. Seeing an editable URL field tells you nothing about whether the provider applies the change immediately, switches all traffic at once, or drops deliveries in the middle.

Find out whether the provider sends a validation request when you save the new URL, and what response it expects back. Providers use this request, called a challenge, to confirm that the new destination meets their verification rules. Other providers give you a separate test event instead. GitHub, for instance, documents a ping test for repository and organization webhooks. If that ping succeeds, you know the test event reached your endpoint, though it does not prove that every production event type or downstream action will work.

You also need to know when the provider starts using the new URL. When the provider acknowledges your request, it only means it accepted the configuration change; its delivery servers may pick up that change later. Twilio’s Webhooks configuration API documents a propagation window of 30 to 90 seconds. Its rule updates return 202 Accepted along with an operation ID, and Twilio advises you to poll that operation status until it finishes. While the provider rolls out the change, its servers can still deliver events using the old configuration. That timing applies specifically to this Twilio API, and other Twilio webhook changes or other providers may work differently.

Finally, check the documentation or ask support what the provider does with deliveries that are already queued or in flight when you change the URL. Depending on the product, the provider might send them to the old URL, route them to the new one, or handle them in another way. If the docs stay silent on this, treat the behavior as unknown and test it yourself rather than assuming the provider hands off in-flight deliveries cleanly.

Prepare the new receiver before the cutover

Deploy the new receiver and confirm that it accepts every subscribed event type before you point the provider to it. Make sure it runs the authentication and signature checks the provider expects. If updating the URL also changes the subscription secret, load the new secret into the receiver ahead of time and verify that it accepts signatures created with that secret.

If the provider offers a documented test, run it. GitHub’s test delivery lets you confirm that your configured URL responds to a test event. With other providers, check what the test covers, because a passing test might only confirm network connectivity while skipping signature checks, specific event types, or your business logic.

Pay close attention to which API call you use to update the URL, since some calls carry side effects. For a GitHub repository webhook, the REST API supports changing the URL through a configuration-only update, which requires repository Webhooks write permission or the documented classic-token scope. Use that endpoint when you only want to change the URL. GitHub’s broader webhook update operation handles secrets differently: if your webhook has a secret, you must include the same secret or a new one in the request, or GitHub will remove it. After you save the change, verify that your receiver still validates signatures as expected.

Choose a cutover the provider supports

When the provider lets you edit the existing subscription, wait until the new receiver is ready before you submit the change. Log your update request and the provider’s acknowledgment. If the provider gives you an operation status or a completion signal, check it to confirm when the change goes live, since the initial success response alone does not prove that the provider has switched deliveries over.

When the provider lets you run two subscriptions at once, check whether it sends the same event types to each subscription independently. If it does, your processing layer may receive duplicate deliveries, and the provider still might not guarantee that every event reaches both destinations. Decide ahead of time how your receiver will spot repeated event identifiers, and verify how you will disable the old subscription once the cutover is done.

Some providers let you shift traffic in stages, though that control may apply to delivery settings instead of two separate callback URLs. Twilio’s configuration API can split matching webhooks between two Settings by percentage, and Twilio’s guidance recommends testing the new Setting and raising its share gradually. The documentation does not state that this feature copies each event to both destinations or moves a subscription between two URLs. Before you rely on a percentage split to migrate a URL, verify what that control changes.

Monitor both destinations and reconcile the cutover

Track the configuration change separately from your live event traffic. Write down the old and new URLs, the subscription identifier, the update time, the provider’s response, and any completion status. Then compare the provider’s delivery records, if it offers them, against the records persisted by both receivers. A successful HTTP response only tells you that the receiver answered the provider; it does not prove that the receiver saved the event or finished the related business action.

Match events using stable event identifiers whenever the provider supplies them. Define a cutover window that starts at the last confirmed delivery to the old receiver and ends after the first confirmed delivery to the new receiver plus an agreed stretch of healthy traffic. Compare the provider’s event or delivery history with what each receiver stored, and look into any gaps, duplicates, late arrivals, or signature failures.

What you can inspect or replay depends on the provider. GitHub provides delivery-related API endpoints that let you list deliveries and ask GitHub to redeliver a specific one. PayPal’s Webhooks Management API lets you list event notifications and resend a single notification by event ID. Both tools help you investigate or recover specific events, though neither one means the provider keeps event history forever or guarantees that no event was lost.

Leave the old receiver running until you know how long delayed or in-progress deliveries from that provider can keep arriving, and until the new receiver has handled healthy traffic. If neither the documentation nor your own test tells you how long stray deliveries can show up, do not pick a fixed shutdown date without evidence. Keep a way to roll back to the old configuration until your observation period is over.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *