Skip to content

Instantly share code, notes, and snippets.

@MosheBerman
Created September 15, 2016 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MosheBerman/67e0399c3dc593f06fe57c8f7086ece0 to your computer and use it in GitHub Desktop.
Save MosheBerman/67e0399c3dc593f06fe57c8f7086ece0 to your computer and use it in GitHub Desktop.
A testbed for Firebase Cloud Messaging.
import requests
import json
url = "https://fcm.googleapis.com/fcm/send"
project_key = "firebase-dashboard-project-key"
headers = {
"Authorization": "key={}".format(project_key),
"Content-Type": "application/json"
}
payload = {
'registration_ids': ['app-generated-registration-ids-here'],
'notification': {
"title": "This is SPARTA",
"text": "This is the text"
}
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
response.json()
@MosheBerman
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment