Registry / messaging / firebase-messaging

firebase-messaging

JSON →
library0.4.5pypypi✓ verified 81d ago

A Python client for Firebase Cloud Messaging (FCM) and Google Cloud Messaging (GCM) for sending push notifications. Current version 0.4.5 supports HTTP v1 API and legacy HTTP APIs. Actively maintained with weekly releases.

pip install firebase-messaging
INSTALL
IMPORT
SIG · FIREBASE-MESSAGING
F
firebase-messaging
messagingpythonv0.4.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FcmPushClient
from firebase_messaging import FcmPushClient
from firebase_messaging import FirebaseMessaging
FcmPushClientConfig
from firebase_messaging import FcmPushClientConfig
FcmRegisterConfig
from firebase_messaging import FcmRegisterConfig

Sends a push notification to a single device token using Firebase Cloud Messaging HTTP v1 API.

from firebase_messaging import FirebaseMessaging import os # Initialize with service account JSON file path fb = FirebaseMessaging(credentials_file=os.environ.get('FCM_CREDENTIALS', '')) # Send a simple notification response = fb.send_notification( token='device_token', title='Hello', body='World' ) print(response)
Debug
Known issues
gotchaThe `credentials_file` parameter expects the path to a JSON service account key file, not the raw JSON string. Passing a string that is not a valid file path raises a `FileNotFoundError`.
fix
Ensure you pass a file path string, e.g., `.json` file from Firebase Console.
affects: >=0.4.0
deprecatedLegacy FCM API (HTTP XMPP) support is deprecated in v0.4.5 and will be removed in v0.5. Use the HTTP v1 API instead.
fix
Instantiate `FirebaseMessaging` with `use_legacy=False` (default) and use OAuth2 authentication.
affects: >=0.4.5
breakingIn v0.4.0, the import paths changed. `FirebaseMessaging` was moved from `firebase_messaging.client` to `firebase_messaging`. Old imports will raise `ImportError`.
fix
Update imports: `from firebase_messaging import FirebaseMessaging`
affects: 0.3.x -> 0.4.0
Upgrade
Version history
0.4.5latest on PyPI · released May 10, 2025
Audit
Dependencies
requestsrequiredHTTP client for API calls
cryptographyrequiredJWT token generation for OAuth2
Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources
firebase-messaging — pip install firebase-messaging · libregistry