- Home
- Skills
- APIs & Backend
- Durable Notification Queue: Webhook + FCM v1 Without an SDK
Durable Notification Queue: Webhook + FCM v1 Without an SDK
An application that raises alerts usually sends a notification inline: one HTTP call, no retry, no record.
$39
Works with the AI Agents you already use
Durable Notification Queue: Webhook + FCM v1 Without an SDK
Example session with this skill installed
Configure the notification worker to read from alerts.json, send to my HTTPS endpoint with secret "dev-secret-123", and output the heartbeat to status.json.
- Read your context and instructions
- Compiled the durable notification queue
The notification worker has been configured for the specified file-based pipeline. I have initialized the environment variables and verified the queue semantics via the internal test suite.
Notification Pipeline Configuration
| Component | Path / Value |
|---|---|
| Alert Source | alerts.json |
| Notification Store | notifications.db.json |
| Heartbeat File | status.json |
| Webhook URL | https://api.example.com/webhooks/alerts |
| HMAC Secret | dev-secret-123 |
| Max Retries | 8 (Exponential) |
| Backoff Range | 30s to 1h |
// Example Verification at Receiver
import { crypto } from 'node:crypto';
function signatureMatches(secret, rawBody, incomingSignature) {
const expected = crypto
.createHmac('sha256', secret)
.update(rawBody)
.digest('hex');
return expected === incomingSignature;
}
Next steps
- Run
node --test scripts/notification.test.mjsto confirm the backoff and signature logic in your environment. - Start the worker using
node scripts/worker.mjsto begin polling the alert source. - Monitor
status.jsonto track pending, delivered, and failed counts.
Connects securely to your tools. The creator never sees your data.
About this skill
An application that raises alerts usually sends a notification inline: one HTTP call, no retry, no record. When the receiver is down the alert is gone; when notifications are first switched on, every historical alert fires at once. This worker owns delivery and proves it.
notification-store.mjs: the alert id is the queue key, so an alert is never delivered twice, including across a restart; exponential backoff from 30 seconds doubling to a one-hour ceiling; after 8 attempts the record is kept as failed with its last error instead of disappearing; settled records age out after 30 days under a 5,000-record ceiling while pending records never age out; delivery history per alert; atomic temp-file-plus-rename writes with 0600 permissions.
alert-source.mjs: read-only view of the producer's alert file (object or bare array), one stat per quiet cycle, malformed entries skipped. channels.mjs: an HTTPS webhook signed with HMAC-SHA256 (X-Notification-Signature) plus the receiver-side verifier; buildChannels fails closed on an http URL, a secret under 32 characters, a bad service account or a missing token store, so a typo stops the worker at startup instead of silencing alerts at runtime.
fcm-channel.mjs: Firebase Cloud Messaging HTTP v1 with no admin SDK: a signed RS256 JWT exchanged for an access token that is cached and refreshed a minute early, one send per device token, data messages so the app's own permission check still runs in the background, per-device alert scopes that fail closed when malformed. Only UNREGISTERED marks a token stale (INVALID_ARGUMENT describes the message, not the registration); a partial success is a success, a total failure is retried.
stale-token-sink.mjs: the worker records stale tokens; the producer, sole owner of the push-token file, prunes them with reconcileStaleTokens, which keeps a token the device registered again after the observation and keeps it on equal timestamps. worker.mjs: the cycle loop, history adoption on first enable, a 15-second delivery timeout per record, heartbeat file, --once mode.
Reference: the single-writer table, delivery behaviour, the two Firebase credentials and their very different sensitivity, pruning rationale, systemd notes. 8 tests including a real webhook receiver and a faked FCM transport. Node 20+, no packages.
File-based storage only. Swap the store class if using a database. Supports Webhook and FCM only; Web Push and other channels require manual extension of the delivery interface.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 18 days ago
Requires