Send native system notifications with optional ntfy.sh phone notifications. Use when the user wants to receive notifications for task completion, status updates, or important events.
The notification skill provides a simple, dependency-free way to send native system notifications with optional phone notifications via ntfy.sh. It works seamlessly with both opencode and claude code.
NTFY_SH_CHANNEL: Your ntfy.sh topic name (e.g., my-username-notifications)
NTFY_SH_ENABLE: Enable/disable phone notifications
1, true, or yes to enableimport { sendNotification } from "./notification.ts";
sendNotification("Hello World!", "Basic notification");
sendNotification("Task completed successfully!", "Build Complete");
Ensure environment variables are set:
export NTFY_SH_CHANNEL="kucukkanat-notifications"
export NTFY_SH_ENABLE="1"
Then:
sendNotification("Deployment finished!", "Deploy Success");
Check if phone notifications are available:
import { sendNotification, canSendToPhone } from "./notification.ts";
if (canSendToPhone()) {
sendNotification("Sending to both system and phone", "Status");
} else {
sendNotification("System only - no phone configured", "Warning");
}
Send notifications when:
Long-running operations complete
Task completion
Important status changes
Scheduled operations
// Perform tasks...
await buildProject();
await runTests();
await createPR();
// Notify completion
sendNotification(
"Bug fixed: Login timeout issue\nTests: 47/47 passed\nPR: #123",
"Development Cycle Complete"
);
try {
await deploy();
sendNotification("Version v1.2.3 deployed successfully", "Deploy Success");
} catch (error) {
sendNotification(`Deployment failed: ${error.message}`, "Deploy Failed");
}
// Enable phone notifications temporarily for important alerts
const originalEnable = process.env.NTFY_SH_ENABLE;
process.env.NTFY_SH_ENABLE = "1";
sendNotification("Critical production issue detected!", "Urgent Alert");
// Restore original setting
process.env.NTFY_SH_ENABLE = originalEnable;
osascript for native notification centernotify-send (if available) or terminal bellpowershell toast notifications (if available) or terminal bellThe implementation uses:
fetch API for ntfy.sh (built into Bun)NTFY_SH_CHANNEL is unset but phone notifications are enabledAdd to your shell profile (~/.zshrc or ~/.bashrc):
# Notification settings
export NTFY_SH_CHANNEL="your-username-notifications"
export NTFY_SH_ENABLE="1" # Uncomment to enable phone notifications
Same environment variables apply. Set them in your development environment or project-specific .env file.
NTFY_SH_CHANNEL to your topic namehttps://ntfy.sh/your-topic-name in browser to subscribeconsole.log("Building project...");
await build();
console.log("Running tests...");
const results = await runTests();
if (results.passed) {
sendNotification(
`Build: Success\nTests: ${results.total}/${results.total} passed\nDuration: ${results.duration}`,
"Build & Tests Complete"
);
} else {
sendNotification(
`Build: Success\nTests: ${results.failed} failed\nDuration: ${results.duration}`,
"Build & Tests Failed"
);
}
const startTime = Date.now();
console.log("Processing data...");
const results = await processData();
const duration = formatDuration(Date.now() - startTime);
sendNotification(
`Processed: ${results.count.toLocaleString()} records\nReports: ${results.reports}\nDuration: ${duration}`,
"Data Processing Complete"
);
const services = await deployAllServices();
const summary = services.map(s =>
`${s.status === 'success' ? '✅' : '❌'} ${s.name}: ${s.message}`
).join('\n');
sendNotification(summary, `Deployment: ${services.filter(s => s.status === 'success').length}/${services.length} succeeded`);
username-project)libnotify-bin for notify-send commandNTFY_SH_CHANNEL is set: echo $NTFY_SH_CHANNELNTFY_SH_ENABLE is set to enable itcurl -d "test" https://ntfy.sh/$NTFY_SH_CHANNELNTFY_SH_CHANNEL or disable phone notifications by unsetting NTFY_SH_ENABLE