Created
January 18, 2019 15:23
-
-
Save gregtap/d0e5b27fb836bbb697acf9bdf00334af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase_admin | |
from firebase_admin import credentials, messaging | |
cred = credentials.Certificate("/Users/greg/Downloads/chefclub-notifications-test-1-firebase-adminsdk-0qqbs-7cb7b7b6c4.json") | |
firebase_admin.initialize_app(cred) | |
# This registration token comes from the client FCM SDKs. | |
registration_token = 'cjNg-fBsWsE:APA91bEc-pDmnfkyczdJroTv-KNHpucA7WhYrmxWrgcSz4HHqn5vhodglqI3mqUSZnz0_VhuJjCrvGUVyqbRR-YnP8DuxdeHQyp1BUiF-H2V2ockNJ2OO-yEh6Im2EFhI6KHUd3ettEg' | |
# See documentation on defining a message payload. | |
message = messaging.Message( | |
data={ | |
'score': '850', | |
'time': '2:45', | |
}, | |
token=registration_token, | |
) | |
# Send a message to the device corresponding to the provided | |
# registration token. | |
response = messaging.send(message) | |
# Response is a message ID string. | |
print('Successfully sent message:', response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment