xtrinch / fcm-django-web-demo

Quick demo to demonstrate the use of firebase web push notifications with the use of `javascript` on frontend, `django` on backend and push notifications via `fcm-django` pypi package for django.
74 stars 52 forks source link

TypeError: send_message() missing 1 required positional argument: 'message' #25

Closed bartkim0426 closed 2 years ago

bartkim0426 commented 3 years ago

After following documentation, I got the error below

TypeError: send_message() missing 1 required positional argument: 'message'

After I checked the code, I found out that message argument is mandatory. (https://github.com/xtrinch/fcm-django/blob/bb239015f348c4b58fbd556adac2f11fd73c0e9f/fcm_django/models.py#L117)

So is it should be changed into below?

device.send_message(message=Message(notification=Notification(title='title', body='message')))
onshadeep commented 3 years ago

I am also getting the same issue. How can we solve it?

this is what I had tried devices.send_message(title=self.title, body=self.description, click_action=self.link)

and the below error is coming on the production server TypeError: send_message() missing 1 required positional argument: 'message'

onshadeep commented 3 years ago

@bartkim0426 How can we import Message? I used from fcm_django.messaging import Message, Notification but I am getting error is title invalid

xtrinch commented 2 years ago

from firebase_admin.messaging import Message, Notification

Also the docs have been updated and should now be correct.

apsabareesh commented 1 year ago

from firebase_admin.messaging import Message, Notification

Also the docs have been updated and should now be correct.

Please update the example in readme as well.