▸ Agent Skills
5 min read

Notifications

GitHubnpmcrates.io

API Reference:

Send native notifications to your user using the notification plugin.

Supported Platforms

This plugin requires a Rust version of at least 1.77.2

[TABLE]

Setup

Install the notifications plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add notification
yarn run tauri add notification
pnpm tauri add notification
deno task tauri add notification
bun tauri add notification
cargo tauri add notification
  1. Run the following command in the src-tauri folder to add the plugin to the project’s dependencies in Cargo.toml:

    cargo add tauri-plugin-notification
  2. Modify lib.rs to initialize the plugin:

    #[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {    tauri::Builder::default()        .plugin(tauri_plugin_notification::init())        .run(tauri::generate_context!())        .expect("error while running tauri application");}

    src-tauri/src/lib.rs

  3. If you’d like to use notifications in JavaScript then install the npm package as well:

    npm install @tauri-apps/plugin-notification
    yarn add @tauri-apps/plugin-notification
    pnpm add @tauri-apps/plugin-notification
    deno add npm:@tauri-apps/plugin-notification
    bun add @tauri-apps/plugin-notification

Usage

Here are a few examples of how to use the notification plugin:

The notification plugin is available in both JavaScript and Rust.

Send Notification

Follow these steps to send a notification:

  1. Check if permission is granted

  2. Request permission if not granted

  3. Send the notification

import {  isPermissionGranted,  requestPermission,  sendNotification,} from '@tauri-apps/plugin-notification';// when using `"withGlobalTauri": true`, you may use// const { isPermissionGranted, requestPermission, sendNotification, } = window.__TAURI__.notification;
// Do you have permission to send a notification?let permissionGranted = await isPermissionGranted();
// If not we need to request itif (!permissionGranted) {  const permission = await requestPermission();  permissionGranted = permission === 'granted';}
// Once permission has been granted we can send the notificationif (permissionGranted) {  sendNotification({ title: 'Tauri', body: 'Tauri is awesome!' });}
tauri::Builder::default()    .plugin(tauri_plugin_notification::init())    .setup(|app| {        use tauri_plugin_notification::NotificationExt;        app.notification()            .builder()            .title("Tauri")            .body("Tauri is awesome")            .show()            .unwrap();
        Ok(())    })    .run(tauri::generate_context!())    .expect("error while running tauri application");

Actions

Actions add interactive buttons and inputs to notifications. Use them to create a responsive experience for your users.

Register Action Types

Register action types to define interactive elements:

import { registerActionTypes } from '@tauri-apps/plugin-notification';
await registerActionTypes([  {    id: 'messages',    actions: [      {        id: 'reply',        title: 'Reply',        input: true,        inputButtonTitle: 'Send',        inputPlaceholder: 'Type your reply...',      },      {        id: 'mark-read',        title: 'Mark as Read',        foreground: false,      },    ],  },]);

Action Properties

PropertyDescription
idUnique identifier for the action
titleDisplay text for the action button
requiresAuthenticationRequires device authentication
foregroundBrings app to foreground when triggered
destructiveShows action in red on iOS
inputEnables text input
inputButtonTitleText for input submit button
inputPlaceholderPlaceholder text for input field

Listen for Actions

Listen to user interactions with notification actions:

import { onAction } from '@tauri-apps/plugin-notification';
await onAction((notification) => {  console.log('Action performed:', notification);});

Attachments

Attachments add media content to notifications. Support varies by platform.

import { sendNotification } from '@tauri-apps/plugin-notification';
sendNotification({  title: 'New Image',  body: 'Check out this picture',  attachments: [    {      id: 'image-1',      url: 'asset:///notification-image.jpg',    },  ],});

Attachment Properties

PropertyDescription
idUnique identifier
urlContent URL using asset:// or file:// protocol

Note: Test attachments on your target platforms to ensure compatibility.

Channels

Channels organize notifications into categories with different behaviors. While primarily used on Android, they provide a consistent API across platforms.

Create a Channel

import {  createChannel,  Importance,  Visibility,} from '@tauri-apps/plugin-notification';
await createChannel({  id: 'messages',  name: 'Messages',  description: 'Notifications for new messages',  importance: Importance.High,  visibility: Visibility.Private,  lights: true,  lightColor: '#ff0000',  vibration: true,  sound: 'notification_sound',});

Channel Properties

PropertyDescription
idUnique identifier
nameDisplay name
descriptionPurpose description
importancePriority level (None, Min, Low, Default, High)
visibilityPrivacy setting (Secret, Private, Public)
lightsEnable notification LED (Android)
lightColorLED color (Android)
vibrationEnable vibrations
soundCustom sound filename

Managing Channels

List existing channels:

import { channels } from '@tauri-apps/plugin-notification';
const existingChannels = await channels();

Remove a channel:

import { removeChannel } from '@tauri-apps/plugin-notification';
await removeChannel('messages');

Using Channels

Send a notification using a channel:

import { sendNotification } from '@tauri-apps/plugin-notification';
sendNotification({  title: 'New Message',  body: 'You have a new message',  channelId: 'messages',});

Note: Create channels before sending notifications that reference them. Invalid channel IDs prevent notifications from displaying.

Security Considerations

Aside from normal sanitization procedures of user input there are currently no known security considerations.

Default Permission

This permission set configures which notification features are by default exposed.

Granted Permissions

It allows all notification related features.

This default permission set includes the following:

  • allow-is-permission-granted
  • allow-request-permission
  • allow-notify
  • allow-register-action-types
  • allow-register-listener
  • allow-cancel
  • allow-get-pending
  • allow-remove-active
  • allow-get-active
  • allow-check-permissions
  • allow-show
  • allow-batch
  • allow-list-channels
  • allow-delete-channel
  • allow-create-channel
  • allow-permission-state

Permission Table

IdentifierDescription
notification:allow-batchEnables the batch command without any pre-configured scope.
notification:deny-batchDenies the batch command without any pre-configured scope.
notification:allow-cancelEnables the cancel command without any pre-configured scope.
notification:deny-cancelDenies the cancel command without any pre-configured scope.
notification:allow-check-permissionsEnables the check_permissions command without any pre-configured scope.
notification:deny-check-permissionsDenies the check_permissions command without any pre-configured scope.
notification:allow-create-channelEnables the create_channel command without any pre-configured scope.
notification:deny-create-channelDenies the create_channel command without any pre-configured scope.
notification:allow-delete-channelEnables the delete_channel command without any pre-configured scope.
notification:deny-delete-channelDenies the delete_channel command without any pre-configured scope.
notification:allow-get-activeEnables the get_active command without any pre-configured scope.
notification:deny-get-activeDenies the get_active command without any pre-configured scope.
notification:allow-get-pendingEnables the get_pending command without any pre-configured scope.
notification:deny-get-pendingDenies the get_pending command without any pre-configured scope.
notification:allow-is-permission-grantedEnables the is_permission_granted command without any pre-configured scope.
notification:deny-is-permission-grantedDenies the is_permission_granted command without any pre-configured scope.
notification:allow-list-channelsEnables the list_channels command without any pre-configured scope.
notification:deny-list-channelsDenies the list_channels command without any pre-configured scope.
notification:allow-notifyEnables the notify command without any pre-configured scope.
notification:deny-notifyDenies the notify command without any pre-configured scope.
notification:allow-permission-stateEnables the permission_state command without any pre-configured scope.
notification:deny-permission-stateDenies the permission_state command without any pre-configured scope.
notification:allow-register-action-typesEnables the register_action_types command without any pre-configured scope.
notification:deny-register-action-typesDenies the register_action_types command without any pre-configured scope.
notification:allow-register-listenerEnables the register_listener command without any pre-configured scope.
notification:deny-register-listenerDenies the register_listener command without any pre-configured scope.
notification:allow-remove-activeEnables the remove_active command without any pre-configured scope.
notification:deny-remove-activeDenies the remove_active command without any pre-configured scope.
notification:allow-request-permissionEnables the request_permission command without any pre-configured scope.
notification:deny-request-permissionDenies the request_permission command without any pre-configured scope.
notification:allow-showEnables the show command without any pre-configured scope.
notification:deny-showDenies the show command without any pre-configured scope.

Support on Open CollectiveSponsor on GitHub

© 2026 Tauri Contributors. CC-BY / MIT


Last updated Oct 08, 2026