When I started sending a "word for today" notification in a wellness app, something occurred to me. The user taps the notification, opens the app, reads the message, and closes it again. They were launching the entire app for nothing more than that. If it's just to read, wouldn't it be kinder to let it complete inside the notification itself? That thought is what led me to interactive notification actions.
Interactive notification actions are the buttons and text-input fields that appear when you long-press (or swipe down on) a notification. It's the mechanism behind a "Done / Later" button on a reminder, or a reply field on a message. Because the user can finish the action right there without opening the app, the number of steps drops dramatically.
Rork tends to generate the basic code for sending and receiving notifications, but often not the action definitions or background handling. Here is the design for adding this to an Expo (React Native) app, drawn from my experience as an indie developer shipping apps on the App Store and Google Play.
Define actions grouped into "categories"
Notification actions aren't defined as loose individual buttons; they're grouped into a unit called a "category." For example, you bundle "Done" and "Remind in 1 hour" into a "reminder" category, then specify that category when you send the notification.
In Expo you define them with setNotificationCategoryAsync from expo-notifications.
// notificationCategories.ts — register once at app launch
import * as Notifications from "expo-notifications";
export async function registerCategories() {
await Notifications.setNotificationCategoryAsync("reminder", [
{
identifier: "complete",
buttonTitle: "Done",
options: { opensAppToForeground: false }, // handle in background, no launch
},
{
identifier: "snooze",
buttonTitle: "Remind in 1 hour",
options: { opensAppToForeground: false },
},
]);
await Notifications.setNotificationCategoryAsync("daily_word", [
{
identifier: "reply",
buttonTitle: "Write a reflection",
textInput: {
submitButtonTitle: "Send",
placeholder: "A word about how you feel…",
},
options: { opensAppToForeground: true }, // save in-app after input
},
]);
}The value of opensAppToForeground is the crux of this design. Set it to false and the work runs without bringing the app to the front; set it to true and the app opens after the action. The basic split: false for instant work like a "Done" button, true for work like text input that you'll want to show a screen for afterward.
On the sending side, specify the matching category ID in categoryIdentifier.
await Notifications.scheduleNotificationAsync({
content: {
title: "Time to water",
body: "Give your houseplant a drink",
categoryIdentifier: "reminder", // the category defined above
},
trigger: { hour: 9, minute: 0, repeats: true },
});Receive the action and branch the handling
The result of a button press arrives via addNotificationResponseReceivedListener. Which action was pressed is in actionIdentifier, and the text-input contents are in userText.
// notificationHandler.ts
import * as Notifications from "expo-notifications";
export function listenForActions() {
return Notifications.addNotificationResponseReceivedListener(async (res) => {
const action = res.actionIdentifier;
const data = res.notification.request.content.data;
if (action === "complete") {
await markReminderDone(data.reminderId);
} else if (action === "snooze") {
await Notifications.scheduleNotificationAsync({
content: { title: "Reminder", body: data.body, categoryIdentifier: "reminder" },
trigger: { seconds: 3600 },
});
} else if (action === "reply") {
await saveReflection(res.userText ?? ""); // text input arrives in userText
}
});
}Watch out: actionIdentifier also carries OS-reserved special values. A plain tap on the notification body delivers Notifications.DEFAULT_ACTION_IDENTIFIER. If you forget to branch — handling only your own actions and routing the default tap to normal navigation — body taps go unresponsive. I shipped exactly that bug once: "tapping the notification normally does nothing."