• Chrome extensions
  • Manifest V3
  • Notifications
  • Analytics

Chrome extension notifications: create, test and fix them

Chrome extension notifications in Manifest V3: create them in the service worker, handle clicks, test on macOS and Windows, and fix ones that never appear.

Author
Extenify Team
Published
Reading time
11 min read
Two rusty round metal bells with split openings resting on a weathered wooden surface

Chrome extension notifications are the system pop-ups an extension shows through the chrome.notifications API: a title, a message, an icon and up to two buttons, drawn by the operating system's own notification center on macOS and Windows. Getting one on screen takes a single call. Getting it to show every time, survive a sleeping service worker and do something useful when clicked is where most developers get stuck, and the threads in the Chromium Extensions group show the same questions year after year.

This guide walks through a working Manifest V3 setup, the click and close events, a test routine for each platform, the reasons a notification silently fails, and how to measure whether anyone acts on your notifications at all.

Key takeaways

  • Add the notifications permission, then call chrome.notifications.create() with the four required fields: type, iconUrl, title and message.
  • Register onClicked, onButtonClicked and onClosed at the top level of the service worker, and keep what a click should open in chrome.storage.session, because the worker may be gone by the time the user clicks.
  • Use a new notification ID each time. On macOS, a notification with the same ID, title and message as one already shown may not appear again.
  • When nothing appears, check the operating system first: Chrome's entry in macOS or Windows notification settings, and Focus or Do Not Disturb.
  • The Chrome Web Store bans notifications used for spam, ads or promotions, so send only what the user asked for.

How Chrome extension notifications work

A Chrome extension notification is created by your extension's code and displayed by the system tray, not by a web page. Google's Use the Notifications API guide describes four templates and notes that on macOS users see native macOS notifications instead of Chrome's own.

Template What it adds Platform caveat
basic Icon, title, message, up to two buttons None
image An image preview (imageUrl) Images are not shown on macOS
list Several items, each with a title and message Only the first item is shown on macOS
progress A progress bar from 0 to 100 On macOS the progress shows as a percentage in the title

Because basic is the only template that looks the same everywhere, it is the safe default. The API reference (last updated October 29, 2026) also marks imageUrl and appIconMaskUrl as deprecated since Chrome 59, and isClickable as ignored since Chrome 67, so do not build anything that depends on them.

The extension gets the notification permission when the user installs it. There is no runtime prompt like the one websites show. getPermissionLevel() returns "granted" or "denied", and the user can still turn notifications off for Chrome at the operating system level, which the API cannot see.

Create a notification in Manifest V3

Start with the permission and a background service worker in manifest.json:

{
  "manifest_version": 3,
  "name": "Build Watcher",
  "version": "1.0.0",
  "permissions": ["notifications", "storage"],
  "background": { "service_worker": "background.js", "type": "module" },
  "icons": { "128": "icons/icon-128.png" }
}

Then create the notification from the service worker. Every field below except buttons, priority and requireInteraction is required by create():

// background.js
const ICON = chrome.runtime.getURL('icons/icon-128.png');

export async function notifyBuildFailed(build) {
  // A fresh ID per event. Reusing one replaces or hides the earlier notification.
  const id = `build-${build.id}-${Date.now()}`;

  await chrome.notifications.create(id, {
    type: 'basic',
    iconUrl: ICON,
    title: `Build ${build.number} failed`,
    message: `${build.branch}: ${build.failedTests} tests failed`,
    contextMessage: build.repo,
    buttons: [{ title: 'Open build' }, { title: 'Mute this branch' }],
    priority: 0,
  });

  // Remember what a click should do. The worker can be stopped before the click.
  await chrome.storage.session.set({ [id]: { url: build.url, branch: build.branch } });
  return id;
}

A few rules from the reference are worth repeating, because they cause most of the errors people post about:

  • iconUrl is required and must be a data URL, a blob URL, or a file inside your extension package. A remote image URL is the classic reason create() fails with an error about downloading images; bundle the icon, or fetch it yourself and pass a data URL.
  • At most two buttons. Extra entries are not shown.
  • priority runs from -2 to 2. Values below 0 are only shown in the ChromeOS notification center and produce an error on Windows, Linux and macOS, so keep it at 0 or above.
  • requireInteraction: true keeps the notification on screen until the user acts. Use it only for something the user must see, such as a failed payment or an expiring session.
  • silent: true suppresses sounds and vibrations.

Since Chrome 116 every method returns a promise, so await works without callbacks. If you also ship to Firefox or Safari, Chrome has supported the standard browser.* namespace since Chrome 148, and the same calls work as browser.notifications.create().

Handle clicks, buttons and closes

The notifications API has three events you will use: onClicked for a click on the body, onButtonClicked with the button index, and onClosed with a byUser flag that tells you whether the user dismissed it or the system cleared it.

Register them at the top level of the service worker, not inside another function or a promise. Chrome wakes a stopped worker to deliver an event only if the listener was registered synchronously when the script first ran.

// background.js (top level)
chrome.notifications.onClicked.addListener(async (id) => {
  const { [id]: data } = await chrome.storage.session.get(id);
  if (data?.url) await chrome.tabs.create({ url: data.url });
  await chrome.notifications.clear(id);
  await countEvent('clicked');
});

chrome.notifications.onButtonClicked.addListener(async (id, buttonIndex) => {
  const { [id]: data } = await chrome.storage.session.get(id);
  if (!data) return;
  if (buttonIndex === 0) await chrome.tabs.create({ url: data.url });
  if (buttonIndex === 1) await muteBranch(data.branch);
  await chrome.notifications.clear(id);
  await countEvent(buttonIndex === 0 ? 'button_open' : 'button_mute');
});

chrome.notifications.onClosed.addListener(async (id, byUser) => {
  await chrome.storage.session.remove(id);
  await countEvent(byUser ? 'dismissed' : 'expired');
});

chrome.storage.session keeps the data in memory for the browser session, which is the right lifetime for "what should this notification open". For the event counts, use chrome.storage.local, which survives restarts. The limits of each area are in our guide to Chrome extension storage limits.

Do not fire a notification from chrome.runtime.onInstalled just to say "thanks for installing". In the Chromium Extensions thread about notifications that never appear, a Chrome extension developer advises against creating notifications in onInstalled; a welcome tab is the better pattern, and our chrome.runtime.onInstalled guide shows how to open one only on a real first install.

Test Chrome extension notifications

The fastest test needs no UI. Open chrome://extensions, turn on Developer mode, click the service worker link under your extension, and run this in its DevTools console:

await chrome.notifications.getPermissionLevel();
// "granted"

await chrome.notifications.create(`test-${Date.now()}`, {
  type: 'basic',
  iconUrl: chrome.runtime.getURL('icons/icon-128.png'),
  title: 'Test notification',
  message: 'If you can read this, the API works.',
});

await chrome.notifications.getAll();
// { "test-1764408000000": true }

If create() resolves with an ID and getAll() lists it, Chrome accepted the notification. If you still see nothing, the problem is in the operating system, not your code. Then test the platforms your users have:

  1. macOS. Open System Settings, then Notifications, and find Google Chrome (and Chrome Beta or Canary if you test there). Notifications must be allowed, and the alert style decides whether a banner appears or the notification goes straight to Notification Center. Check that Focus is off.
  2. Windows. Open Settings, then System, then Notifications, and make sure notifications are on for Google Chrome. Do Not Disturb hides banners. In the same Chromium thread, the developer found that once Chrome was allowed in Windows settings, some notifications still went only to the notification center without a banner or sound.
  3. ChromeOS. Notifications stay in the system tray until dismissed, and this is the only platform where negative priorities are shown at all.
  4. Repeat sends. Send the same notification twice. If the second one never appears, you are reusing an ID or identical content.

For automated tests, a Playwright run can load the unpacked extension and call the worker directly, but it cannot see an operating system notification. Assert on getAll() and on your own event counters instead, as in our guide to testing a Chrome extension with Playwright.

Why a Chrome extension notification is not showing

When a notification does not show, the cause is almost always one of these, roughly in order of how often they come up:

Symptom Likely cause Fix
create() throws about missing properties One of type, iconUrl, title, message is missing Pass all four on every create()
Error about downloading images iconUrl points to a remote URL or a wrong path Use chrome.runtime.getURL() or a data URL
Error on Windows, macOS or Linux only priority set to -1 or -2 Use 0, 1 or 2
Works once, then never again Same ID, or same ID, title and message on macOS Generate a new ID per event, clear() old ones
create() resolves, nothing on screen Chrome blocked in OS settings, Focus or Do Not Disturb Check OS notification settings for Chrome
Shows in notification center but no banner Windows or macOS alert style Expected; tell users how to change the style
Click does nothing after a few minutes Listener registered late, or click data kept in a variable Register listeners at top level, keep data in chrome.storage.session
Two notifications per event The triggering listener fires twice, for example once per frame Filter the event, such as details.frameId === 0 for the main frame

The last row comes from the same Chromium thread: a webNavigation.onCompleted listener fired once per frame, and the second notification with the same ID silently replaced the first. Navigation events are frequent, so rate-limit anything you trigger from them.

Measure whether users act on notifications

A notification that nobody clicks is noise, and noise is what gets an extension muted or uninstalled. The three events above give you a simple funnel: created, clicked (body or button), dismissed by the user, or expired.

async function countEvent(name) {
  const key = `notif_${name}`;
  const { [key]: count = 0 } = await chrome.storage.local.get(key);
  await chrome.storage.local.set({ [key]: count + 1 });
}

Call countEvent('created') after each create(), then send the totals once a day to your analytics tool. Our guides cover GA4 in a Manifest V3 extension and PostHog in a Chrome extension without remote code. Two ratios tell you most of what you need:

  • Click rate: (clicked + button presses) / created. If it falls after you add a new notification type, that type is probably not wanted.
  • Dismiss rate: dismissed / created. A high share of notifications closed by the user without a click is an early warning that people find them annoying.

Then watch the outside signals. A notification change that annoys users shows up as a dip in weekly users, a run of low-star reviews, or more uninstalls, usually within days of the release. Our guides to a drop in weekly users and measuring retention and uninstalls cover how to read those numbers.

Stay within the Chrome Web Store notification rules

The Chrome Web Store program policies treat notification abuse as spam. The Spam and Abuse section says the store does not allow extensions "that abuse, or are associated with abuse, of notifications by sending spam, ads, promotions, phishing attempts, or unwanted messages that harm the user's browsing experience."

In practice that means:

  • Send notifications only for events the user asked to hear about, and give them a setting to turn each type off.
  • Do not use notifications to advertise your other products, upgrades or partner offers.
  • Never imitate a system or security warning to get a click.
  • Keep the number low. A daily digest is often better than ten separate pop-ups.

An extension removed for spam is hard to bring back, and our guide to an extension removed from the Chrome Web Store explains what the appeal looks like.

Notifications about your listing, not from it

Notifications inside your extension tell users about their own events. Many developers also want the opposite: a notification for themselves when something changes on the store, such as a new one-star review, a drop in users or a competitor's release. That is a different job, covered in our guide to Chrome extension review notifications, and it is what Extenify's extension monitoring does: it checks your listings and your competitors' on the Chrome Web Store, Edge Add-ons and Firefox Add-ons once a day and sends changes in installs, ratings, reviews, versions and rank moves to email, Slack, Discord, Telegram or Microsoft Teams. Plans and the free trial are on the pricing page.

Frequently asked questions

Why is my Chrome extension notification not showing?

First check that create() resolves and that getAll() lists the ID. If it does, Chrome accepted it and the operating system is hiding it: allow notifications for Google Chrome in macOS or Windows settings and turn off Focus or Do Not Disturb. If create() fails, you are missing a required field, using a remote icon URL, or passing a negative priority.

Do Chrome extensions need to ask permission to show notifications?

No runtime prompt is needed. Declaring the notifications permission in the manifest grants it at install time. Users can still block notifications for Chrome in their operating system, and getPermissionLevel() cannot detect that.

How do I show a notification from a Manifest V3 service worker?

Call chrome.notifications.create() directly in the service worker; it does not need a page or an offscreen document. Register the click listeners at the top level of the worker and store any data a click needs in chrome.storage.session.

Can a Chrome extension notification have more than two buttons?

No. Every template supports up to two buttons. For more choices, open a page or the popup when the notification is clicked.

Why don't images appear in my notification on Mac?

macOS uses its native notification system, which does not show the image template's picture and shows only the first item of a list notification. Use the basic template if the content must look the same on every platform.

Summary

To ship reliable Chrome extension notifications, declare the notifications permission, call chrome.notifications.create() with type, iconUrl, title and message, use a new ID each time, and register click and close listeners at the top level of the service worker with their data in chrome.storage.session. Test from the service worker console, then check macOS and Windows notification settings when nothing appears. Count clicks and dismissals so you know which notifications users want, and stay well clear of anything that looks like promotion, which the Chrome Web Store treats as spam.

Image credits

Put every store in one dashboard tonight.

Sign in with Google, paste one store link, and your unified view is live in under a minute. Then 7 days of Pro free, no credit card required, and you never touch your app's code.

Start free trial