olucurious / PyFCM

Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
http://olucurious.github.io/PyFCM/
MIT License
803 stars 206 forks source link

"message_image" is missing #267

Closed lovato closed 2 years ago

lovato commented 4 years ago

Hi. I am trying to send an image using a URL, and after reading some documentation, I did this change:

https://github.com/olucurious/PyFCM/blob/master/pyfcm/baseapi.py#L244

        if message_icon:
            fcm_payload['notification']['icon'] = message_icon
            fcm_payload['notification']['image'] = message_icon

I know this is wrong, but only after doing that, my "icon" started to show up. In fact, looks like both icon and message can be used, but I was not able to confirm that yet.

I am sure that FCM accepts an "image" URL object because I am using it on my local implementation.

I can make a PR with this fix, but I still would like to confirm that "message_icon" is working. I am not sure yet what exactly to put in there. My app is being written in Flutter.

I can just create a "message_image" parameter, or check if "message_icon" starts with "HTTP". Please give me instructions.

I tested both on iOS and Android.

Marco

lovato commented 4 years ago

Hi @olucurious Any ideas here? I offer myself to code it, I just want to have clarity about the right approach. If your development goes to test PyPI (like I did my hooks4git), this will be more than enough for me.

rahulchhabra07 commented 4 years ago

Can confirm this worked.

Relevant documentation: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages

lovato commented 4 years ago

@olucurious I just need some orientation about what to code, and then submit a PR against develop. Since I don't know exactly how you are willing to support this, my fix can/cannot be a fit. I am using my fix on a daily basis via monkey patching.

FirefighterBlu3 commented 3 years ago

@lovato the fcm_payload['notification'] dict is updated with everything from extra_notification_kwargs

So you don't really need to add more code. just add extra_notification_kwargs={'image': ...} to your call