posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat: add Firebase push notification integration (slice 1)

Open MattBro opened this issue 1 month ago â€ĸ 2 comments

Problem

PostHog workflows need the ability to send push notifications to customers' mobile app users. This is the first slice toward that capability.

Changes

This adds the foundation for Firebase Cloud Messaging (FCM) push notifications:

  • Backend Integration: FirebaseIntegration class for storing Firebase service account credentials with automatic OAuth2 token refresh
  • API Endpoint: Upload Firebase service account JSON via integration API
  • Hog Function Template: firebase_push destination template with configurable title, body, and FCM token
  • Frontend: Firebase integration choice UI with proper icons and types
  • Documentation: Implementation plan and testing guide

Architecture: PostHog acts as a conduit - customers provide their Firebase credentials, and we send pushes on their behalf. The notification appears to come from the customer's app.

How did you test this code?

  • ✅ Unit tests for FirebaseIntegration class (token refresh, credential validation)
  • ✅ Template tests for Hog function
  • ✅ Standalone FCM test script validated (push received on Android emulator)
  • ✅ Firebase integration created via Django shell
  • 🔄 End-to-end workflow test pending (event → workflow → FCM push)

See products/workflows/docs/testing-firebase-push.md for detailed testing instructions.

Changelog

No - This is slice 1 of multiple. Complete feature will include SDK methods to capture device tokens.


Future slices:

  • Slice 2: iOS SDK captures and sends FCM token
  • Slice 3: Workflow looks up token from PushSubscription model
  • Slice 4: Android SDK support
  • Slice 5: Rich push (images, action buttons, deep links)

🤖 Generated with Claude Code

MattBro avatar Dec 10 '25 12:12 MattBro

Size Change: 0 B

Total Size: 3.7 MB

â„šī¸ View Unchanged
Filename Size
frontend/dist/toolbar.js 3.7 MB

compressed-size-action

github-actions[bot] avatar Dec 10 '25 12:12 github-actions[bot]

🔍 Migration Risk Analysis

We've analyzed your migrations for potential risks.

Summary: âš ī¸ Missing migrations detected

Migrations for 'posthog':
  posthog/migrations/0940_remove_annotation_is_emoji_and_more.py
    - Alter field kind on integration

Run python manage.py makemigrations to create them.

Last updated: 2025-12-11 22:32 UTC (eea54a7)

github-actions[bot] avatar Dec 10 '25 12:12 github-actions[bot]

This stack of pull requests is managed by Graphite. Learn more about stacking.

MattBro avatar Dec 10 '25 16:12 MattBro