Messages not getting sent(Python)

34 views
Skip to first unread message

cory

unread,
Dec 14, 2018, 12:08:30 AM12/14/18
to Firebase Google Group
I attempt to send a message to a token I received from my iOS app, but it doesn't actually get sent to my device. It appears to be successful, though and I get a url response like "/projects/<project_name>/messages/<message_id>", but I'm not really sure what to do with that information. When I attempt to access that URL from my browser it just redirects me to the base firebase console domain and gives me a blank screen. Here's a minimal script that I'm using to test:
import firebase_admin
from firebase_admin import credentials, messaging

token
= "<registration token>"
creds
= credentials.Certificate('<path to json file>')
app
= firebase_admin.initialize_app(creds)
msg
= messaging.Message(data={'title': 'Test'}, token=token)
print(messaging.send(msg, app=app))

I know my app can receive push notifications, though, because I've sent them through the "test" option in the notifications composer on the firebase console. I'm also not seeing the notifications I'm attempting to send show up in the notifications list. The fact that in the python library they're called a Message and in Firebase they're called notifications makes me think I'm doing something completely wrong.

Reply all
Reply to author
Forward
0 new messages