-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How should we send notifications to multiple tokens with the updated API? #338
Comments
Please use v2.0.3 |
Thanks for the quick response! I'm on Python 3.6.9. |
Tried pip-installing 2.0.3 from github, but it failed with google-auth being too old (2.22.0 being the latest for Python 3.6 according to this). Sending notification to a single device works fine, so there is no problem with auth in itself. Is there a way we could make it work with older google-auth? |
Unfortunately I’m stuck on an older version (at most 2.22.0), on which pyfcm 2.0.0 installed and seemingly works fine (except the multiple device issue).
… On 20 Jun 2024, at 16:11, Emmanuel O. Adegbite ***@***.***> wrote:
Did you mean to say "make it work with newer google-auth?"
—
Reply to this email directly, view it on GitHub <#338 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABJQCZYQGAYAZJB6TYSSYG3ZILIGZAVCNFSM6AAAAABJT3E4TKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBQGY2DONRYGI>.
You are receiving this because you authored the thread.
|
Changing the requirement to 2.22.0 and installing What might break due to this requirement change? |
Can you try the new version |
Could you please update setup.py too? (reference 2.22.0 instead of 2.29.0) |
Also, annotations import fails on 3.6.9:
|
(also, aiohttp (3.8.6) dependency still needs to be manually installed) |
one more thing: the following comma in pyfcm/baseapi.py seems to cause troubles for both iOS and Android:
|
Can someone please help me with the structure of the payload that needs to be passed to |
@sathvik-grexit it's apparently the same as for a single |
@sgserg can you please add an example in readme or here?
what should be the new way? |
push_service = FCMNotification(service_account_file="", project_id="") fcm_tokens = [] params_list =[{"fcm_token":fcm_token,"notification_title":notification_title,"notification_body":notification_body,"notification_image":'https://synak.pro/static/img/about-1.png',"data_payload":data_payload} for fcm_token in fcm_tokens] result = push_service.async_notify_multiple_devices(params_list=params_list, timeout=5) |
params_list =[{"fcm_token":fcm_token,"notification_title":notification_title,"notification_body":notification_body,"notification_image":'https://synak.pro/static/img/about-1.png',"data_payload":data_payload} for fcm_token in fcm_tokens]
result = push_service.async_notify_multiple_devices(params_list=params_list, timeout=5) Why are we repeating the same data for each key instead of just sending a list of registration_ids as we did in older versions? This approach seems redundant and might complicate the process. Could we simplify this by going back to the previous versions (sending the registration_ids) Thanks! |
Actually this is solving the another issue, If we have to send different notification messages to difference users at the same time. Comparing with multiple single notify() call in the loop, this is better. |
Attempting to use
async_notify_multiple_devices
yieldsThe text was updated successfully, but these errors were encountered: