Comments (10)
'kwargs' is not a keyword argument, so don't name it, just pass it as the last argument.
Also please be more specific as to how the payload gets 'messed up'.
from fcm-django.
I changed the code to:
kwargs = {
'content_available': True
}
devices.send_message(
title="Syncup",
body=".",
icon="appicon",
data={
"notification type" : 20
},
kwargs
)
But now I am getting error:
SyntaxError: non-keyword arg after keyword arg
And for the missing 'body' part, the payload changes from
{"data":{"notification type":20},"notification":{"body":".","icon":"appicon","title":"Syncup"},"priority":"high","to":"cF3VXFqliZQ:APA91bG3xXHeuoIx2TMYXLcTXooqQyRPiKzfGL4l4h8Cfxpl3vFBVmYY2YuqV6odipSnET2LNv3q4th5qxstNmonf_w2MnUrP77TNWfLV4iDlmNc_gCQPoR_w6F4U-3hJkVAM3ujNKMY"}
to(title goes missing)
{"data":{"notification type":20},"notification":{"icon":"appicon"},"priority":"high","to":"cF3VXFqliZQ:APA91bG3xXHeuoIx2TMYXLcTXooqQyRPiKzfGL4l4h8Cfxpl3vFBVmYY2YuqV6odipSnET2LNv3q4th5qxstNmonf_w2MnUrP77TNWfLV4iDlmNc_gCQPoR_w6F4U-3hJkVAM3ujNKMY"}
(when I remove key "body" from above code).
from fcm-django.
http://stackoverflow.com/questions/1496346/passing-a-list-of-kwargs for passing kwargs
from fcm-django.
For the second part - pyfcm's github page is where that question would be answered best, because that part is handled in this file.
from fcm-django.
Thank you for the help. But, I'm still not able to send "mutable_content": True
even in kwargs. I am getting notify_single_device() got an unexpected keyword argument 'mutable_content'
error.
from fcm-django.
How did you end up fixing this? @monicaphalswal
from fcm-django.
The initial problem was that the function call had kwargs=extra_kwargs
instead of the correct **kwargs
(dictionary unpacking, to add more param=value parameters to the call).
The second problem is different (passing an unknown parameter to a function).
from fcm-django.
The question is for an obsolete version which used the legacy API, so this question is most likely not relevant anymore
from fcm-django.
Ah okay. I want to add channel_id from https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification to my notification payload so I was looking at this to see how it would be possible. I was thinking this would work but maybe I am on the wrong track?
fcm_send_topic_message(message_title=messageTitle,
message_body=messageBody,
condition=favoritesConditions,
data_message=notif_data,
sound="Default",
extra_kwargs={"android": "{\"notification\": {\"channel_id\": \"" + time_topic + "\"}}"})
from fcm-django.
from firebase_admin.messaging import Message, Notification
topic = "A topic"
FCMDevice.objects.handle_subscription(True, topic)
FCMDevice.send_topic_message(Message(data={...}), "TOPIC NAME")
And the channel ID you would pass into the Message constructor under android_config, see
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource:-message
from fcm-django.
Related Issues (20)
- Setting `content_available: True` HOT 2
- is_cool=True from the docs HOT 1
- user and device type filters in admin dashboard HOT 1
- `InvalidArgumentError` should not cause deactivation of token HOT 8
- Celery and FCM-django HOT 1
- Problem with sending notifications to topic in bulk HOT 7
- Sound and Badge not working when notification arrives in IOS HOT 4
- Documentation about installing with pip seems to be broken on readthedocs HOT 3
- Can this package be compatible with firebase-admin 6? HOT 5
- Add updated_at field HOT 8
- Backward compatible Updates!!!!! HOT 3
- unique registration_id as textfield broken on mysql HOT 11
- USER_MODEL configuration in FCM_DJANGO_SETTINGS not working HOT 5
- Compatibility with Python 3.11 and Django 4.2 HOT 1
- Deprecated send_all() and send_multicast() methods HOT 6
- set badge count dynamically by user HOT 3
- Issue in migration HOT 2
- Changes related to the firebase API migration (batch send) HOT 2
- OperationalError: "max key length is 3072 bytes" when running tests w/ MySQL w/o migrations
- Incorrectly marking devices as inactive HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fcm-django.