Skip to main content
@capgo/capacitor-notifications Device APIs Open source

Notifications Capacitor plugin

Send native iOS and Android push notifications from Capgo with user lookup, badges, stats, and silent update checks

Install

bun add @capgo/capacitor-notifications bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-notifications
  • pnpm add @capgo/capacitor-notifications
  • yarn add @capgo/capacitor-notifications

Guide

How to use Notifications in Capacitor

Using @capgo/capacitor-notifications

Send native iOS and Android push notifications from Capgo with user lookup, badges, foreground/open tracking, background callbacks, and silent Capgo live-update checks.

The plugin is built for the Capgo notification pipeline. Capgo stores platform credential metadata and campaign control data in Postgres, while active device state and delivery events are written to Cloudflare Analytics Engine.

Install

Use the Capgo CLI for a guided setup:

npx @capgo/cli@latest notifications setup com.example.app

Manual install:

npm install @capgo/capacitor-notifications @capgo/capacitor-updater
npx cap sync

Configure

import { CapgoNotifications } from '@capgo/capacitor-notifications'

await CapgoNotifications.configure({
  appId: 'com.example.app',
  autoUpdater: true,
  updateInstallMode: 'next',
})

Register A Signed User

Mint identityProof from your backend with POST /notifications/recipients/proof, then register the device after your own login succeeds.

await CapgoNotifications.register({
  externalId: 'customer-user-123',
  identityProof,
  tags: ['paid'],
  attributes: { plan: 'team' },
  consent: true,
})

Listen For Events

await CapgoNotifications.addListener('notificationReceived', (notification) => {
  console.log('Received', notification)
})

await CapgoNotifications.addListener('notificationOpened', (event) => {
  console.log('Opened', event.notification.id)
})

await CapgoNotifications.addListener('backgroundNotification', async (event) => {
  try {
    console.log('Background payload', event.notification.data)
  } finally {
    await event.finish()
  }
})

iOS Setup

Enable Push Notifications and Background Modes > Remote notifications in Xcode.

Forward remote notifications from ios/App/App/AppDelegate.swift:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    NotificationCenter.default.post(name: Notification.Name("CapgoNotificationsRemoteNotification"), object: userInfo)
    completionHandler(.newData)
}

Android Setup

Run npx cap sync android, configure Android platform credentials in Capgo, request notification permission on Android 13+, and test on a device or emulator with Google Play services.

Debugging Checklist

  • Run npx @capgo/cli@latest notifications setup com.example.app from the folder that contains capacitor.config.*.
  • Search the recipient in Capgo by external customer ID.
  • Confirm the device has platform android or ios and permission is granted.
  • Add temporary listeners for registrationChanged, notificationReceived, notificationOpened, and backgroundNotification.
  • Send a test notification from the dashboard.
  • Check stats for queued, sent, received, and opened events.
  • For silent update checks, verify @capgo/capacitor-updater is installed and autoUpdater is enabled.

Full Reference

Keep going from Using @capgo/capacitor-notifications

If you are using Using @capgo/capacitor-notifications to plan native push messaging, connect it with @capgo/capacitor-notifications for the implementation detail, Debugging for troubleshooting, @capgo/capacitor-updater for silent update checks, and Capgo Plugin Directory for other native plugins.

FAQ

Notifications plugin FAQ

How do I install the Notifications plugin in a Capacitor app?

Run "bun add @capgo/capacitor-notifications" (or "npm install @capgo/capacitor-notifications"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-notifications" in your app code.

Does @capgo/capacitor-notifications work with React, Vue and Angular?

Yes. Notifications is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-notifications support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-notifications free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capgo/tree/main/packages/capacitor-notifications/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Notifications without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Notifications changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo