Notifications and incoming-call alerts
Notifications connect Teams activity to three user-facing surfaces: the browser notification model, the operating system notification service, and an in-app toast. Incoming calls use a separate alert with accept and decline actions so that a call can be handled even when the main window is not in view. This page complements Communications and meetings, Connectivity and real-time events, and Meeting and chat entry points.
Notification paths
The notification path is selected by notificationMethod. The renderer presents the same Notification-like contract to Teams, then sends the request to the selected surface. This keeps Teams activity independent from the desktop surface that displays it.
Notification methods
The application supports three notification methods:
| Method | User-facing surface | Main behavior |
|---|---|---|
web | The browser notification service | Uses the normal browser notification object and plays the application sound. |
electron | The operating system notification service | Creates a native system notification and relays click and close events back to the renderer. |
custom | An application-owned toast | Shows a short-lived toast that does not depend on the host notification daemon. |
The default is web. The electron and custom paths exist for desktop behavior that the browser cannot provide consistently. The custom path is an opt-in alternative, not a notification history or a general routing layer for every Teams activity type.
References: app/…/preload.js• L217-227 app/…/preload.js• L353-407 app/…/options.js• L565-587
Notification flow
The flow below shows how a Teams notification request becomes a browser notification, a system notification, or an in-app toast.
flowchart TD
A[Teams activity] --> B[Notification-like renderer API]
B --> C{notificationMethod}
C -->|web| D[Browser notification]
C -->|electron| E[Native system notification]
C -->|custom| F[In-app toast]
E --> G[Click or close event]
G --> H[Renderer lifecycle handler]
F --> I[Toast click]
I --> J[Show main window]
References: app/…/preload.js• L275-350 app/…/preload.js• L353-407 app/…/service.js• L38-48 app/…/index.js• L15-21
Native system notifications
The native path moves notification display into the main process. It provides system-level visibility when the Teams window is hidden and can also play a matching notification sound. The system surface controls the final display behavior, so desktop environment support and permissions still affect what the user sees.
Browser notification bridge
The renderer gives Teams a Notification-like object in every mode. For native notifications, that object is a lightweight lifecycle handle rather than the visible notification itself. A notification ID links the handle to the native notification and lets the main process send click and close events to the renderer that created it.
This link matters when more than one account is active. Events return to the creating renderer so one account cannot receive another account's notification state. Closing is idempotent, while a click can still arrive after a close because the desktop notification may remain clickable.
References: app/…/preload.js• L229-255 app/…/preload.js• L297-320 app/…/notificationBridge.js• L15-30 app/…/notificationBridge.js• L39-74
System notification behavior
The native service combines the notification text, urgency, timeout choice, and an optional icon before it asks the operating system to display the alert. It requests the notification sound before display. If an icon cannot be loaded or decoded, the notification still appears without that icon.
Click behavior is configurable. show reveals the main window, restore also restores a minimized window, and none leaves the window and the Teams conversation unchanged. The first two modes then send the click back to Teams so it can open the related conversation.
The timeoutType setting controls whether the desktop may clear the alert automatically or whether the alert asks to remain until dismissal. A desktop notification daemon may not honor this request.
References: app/…/service.js• L58-151 app/…/options.js• L399-419
Notification sounds
Notification sounds are shared by the browser and native paths. The application can disable all sounds or suppress them when the user is not Available. The native path owns sound playback for native notifications so the same event does not play twice.
References: app/…/preload.js• L258-273 app/…/service.js• L229-265 app/…/options.js• L373-397
In-app notification toasts
The custom path displays an application-owned toast in the lower-right corner. It avoids dependence on a desktop notification daemon and gives the app control over the basic presentation. It is designed as a transient alert, not as a replacement for a notification center.
Toast presentation
The main process creates a small, non-taskbar toast window and sends it the title and body after the window is ready. The toast is visible for the configured duration, then closes automatically. Its window does not take focus when it appears, which lets the user continue working in the current window.
Only data with a title is shown. The toast has one interaction: clicking its body closes the toast and brings the main window forward. The custom path has no history, queue, stacking, or action buttons.
References: app/…/index.js• L9-49 app/…/NotificationToast.js• L10-43 app/…/NotificationToast.js• L49-74 app/…/notificationToast.html• L110-133
Toast security boundary
The toast uses a narrow preload API for two actions: receive its display data and report a click. The toast page cannot use Node integration. This keeps the short-lived notification window separate from the broader Teams renderer.
References: app/…/NotificationToast.js• L26-31 app/…/notificationToastPreload.js• L1-15 app/…/ipcValidator.js• L41-63
Incoming-call alerts
Incoming calls use a dedicated alert because they need immediate actions rather than passive activity text. The alert can show caller information and an image, offer audio, video, and decline actions, and optionally run an external command for desktop automation.
Incoming-call event flow
The incoming-call flow starts in the Teams activity layer and ends in the Teams calling controls. The main process owns the alert window and also emits call state events for other desktop integrations.
sequenceDiagram
participant T as Teams activity layer
participant R as Renderer
participant M as Main process
participant A as Incoming-call alert
T->>R: Incoming call created
R->>M: Call details
M->>A: Caller, text, and image
A-->>M: Accept audio, accept video, or decline
M-->>R: Call action
R->>T: Activate matching calling control
T->>R: Incoming call ended
R->>M: End event
M->>A: Hide alert
References: app/…/activityManager.js• L87-115 app/…/browserWindowManager.js• L114-137 app/…/browserWindowManager.js• L208-249
Alert actions
The alert presents three actions: accept with video, accept with audio, and decline. The renderer maps each action to the matching Teams calling control. If the Teams calling controls are not present, the action has no effect; the alert path does not create a second call state.
When the call ends, the alert hides and any configured external command stops. The call start and end events also support integrations such as media status reporting, so an alert change can update another device or service without changing the Teams call itself.
References: app/…/incomingCallToast.html• L106-142 app/…/activityManager.js• L55-85 app/…/browserWindowManager.js• L208-249 app/…/mediaStatusService.js• L50-83
Incoming-call configuration
Incoming-call settings control the alert and the optional external command. The current grouped form is incomingCalls; older flat names remain as compatibility aliases.
| Setting | Purpose |
|---|---|
incomingCalls.toast | Shows or hides the incoming-call alert. |
incomingCalls.command | Runs a configured command when a call starts. |
incomingCalls.commandArgs | Adds configured arguments to that command. |
These settings apply at restart. The command receives caller data after basic argument cleaning, and the running command is stopped when the call ends.
References: app/…/options.js• L463-498 app/…/options.js• L1208-1232 app/…/browserWindowManager.js• L208-249
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the renderer Notification-like lifecycle aligned with the native click and close channels. A mismatch can stop Teams from opening the source conversation or from creating later notifications.
- Preserve the notification ID and the creating renderer as the event route. Multi-account sessions must not share notification lifecycle events.
- Keep
notificationMethod,notifications.timeoutType, andnotifications.electron.clickActionaligned with both the preload selection and the main-process behavior. - Keep custom-toast data and click IPC aligned with the toast preload. A changed payload field can produce an empty toast without a type error.
- Keep incoming-call action names aligned across the toast page, main-process relay, and Teams calling controls.
- Keep incoming-call end handling aligned for the toast, external command, and media status events so no alert or external process remains active after the call ends.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The host notification daemon rejects or cannot show a native notification. | The user may miss an operating-system alert. | Use notificationMethod: "custom" for a daemon-independent in-app toast. |
| The native notification click arrives after the renderer has closed its handle. | Teams may still need the click to open the source conversation. | The bridge keeps a bounded entry after close and dispatches the later click. |
| A notification event is sent to the wrong renderer in a multi-account session. | The wrong account can change lifecycle state or open a conversation. | Route events through the IPC sender that created the notification. |
| A custom toast payload has no title. | No toast is shown. | The custom manager rejects the payload before creating the window. |
| The Teams calling controls are absent when an alert action is clicked. | The requested accept or decline action does nothing. | The renderer checks for the calling action container before clicking a control. |
| An incoming call ends without the end path running. | The alert or external command can remain active. | Call-end handling hides the toast and terminates the configured command. |
Key files
| File | Why to read it |
|---|---|
| app/…/preload.js | Defines the Notification-like API and selects the browser, native, or custom path. |
| app/…/notificationBridge.js | Explains how native click and close events return to Teams. |
| app/…/service.js | Shows native notification display, sound use, icon handling, and click behavior. |
| app/…/index.js | Coordinates custom toast creation and click handling. |
| app/…/NotificationToast.js | Shows the lifetime and placement of an in-app toast. |
| app/…/index.js | Defines the incoming-call alert window and action relay. |
| app/…/incomingCallToast.html | Shows the caller display and the three call actions. |
| app/…/activityManager.js | Connects Teams call events and alert actions to the renderer. |
| app/…/browserWindowManager.js | Owns incoming-call start and end behavior in the main process. |
| app/…/options.js | Defines notification method, system behavior, custom duration, and incoming-call settings. |