swap-push-provider
Add or replace a push notification provider (OneSignal, Expo push, a different FCM or APNs setup). Use when the user wants push delivered through another service or on another platform. Not for debugg
Files1
View on GitHubSKILL.md.claude/skills/swap-push-provider/SKILL.md
GitHubSwap a push provider
- Interface:
PushTransport(send(token, message): Promise<PushResult>) inapps/notifications/src/channels/push/push-transport.ts, one per platform (ios,android,web). - Today:
FcmTransport(fcm.ts, Android),ApnsTransport(apns.ts, iOS),WebPushTransport(web-push.ts, browsers, VAPID). - Selected in:
createTransports()inapps/notifications/src/channels/push/push.module.ts; a platform is on when all of its variables are set (pushPlatformsinapps/notifications/src/env.ts). - Env:
FCM_PROJECT_ID,FCM_CLIENT_EMAIL,FCM_PRIVATE_KEY;APNS_KEY_ID,APNS_TEAM_ID,APNS_PRIVATE_KEY,APNS_BUNDLE_ID,APNS_URL;VAPID_PUBLIC_KEY,VAPID_PRIVATE_KEY,VAPID_SUBJECT(the public key also goes to apps/api, which hands it to browsers). Test hooks:FCM_TOKEN_URL,FCM_API_URL,WEB_PUSH_TEST_ORIGIN.
Swap
- A class implementing
PushTransport. Return{ ok: false, gone: true }for dead tokens (uninstalled app, expired subscription) so the device is forgotten, andgone: falsefor failures worth retrying. - Its variables in
apps/notifications/src/env.ts(all or none, like the others),.env.exampleanddocs/environment.md. - Register it for its platform in
createTransports(). The channel, dispatcher and quiet hours don't change. A provider that uses its own device tokens (Expo push) also changes how apps register devices (apps/mobile, thenotificationsprocedures).
Tests
apps/notifications/test/fake-push.ts fakes FCM, APNs and Web Push; extend it or add a fake
for the new provider, and cover delivery and a dead token in
apps/notifications/test/notifications.integration.test.ts.
Finish
- The verify skill.
- Ask the
revieweragent to review the change, and thesecurity-revieweragent: a new implementation brings its own credentials and sends data somewhere new. If you wrote a migration, themigration-revieweragent too. - Update the seam's row in the README's "Scaling path" table if what's "Now" changed.