Writing Web Push Notification Code With LLMs in November 2026: Ask for Permission After a Click, Store One Subscription per Device, and Delete the Ones That Come Back 410
Web push notifications look like a small feature: ask the browser for permission, save something on the server, send a message later. Ask an LLM for "push notifications for my web app" and you will get a service worker, a subscribe call, and a send function in a few seconds. The code usually runs. The problems show up a week later: the permission prompt fires on page load and most people block it forever, the server keeps one subscription per user and silently loses every device but the last one, and a pile of dead subscriptions makes every send slower and noisier. This post walks through how to get an LLM to write web push code you can actually ship, using the standard Push API, the Notifications API, and VAPID keys. The examples use plain browser JavaScript and the web-push package for Node.js, but the same rules apply in any server language. How the pieces fit together Before you prompt anything, make sure you and the model agree on the moving parts. Mixed-up terms ...