Reputation: 820
I am building a django aplication and I want to know what is the best approach for sending push notifications to users in a react native app if a certain condition is mee. The idea is to send notifications to groups of users. It could be even 100 users at the same time
Upvotes: 2
Views: 3103
Reputation:
Well I have done this just an hour ago. Try this:
pip install pyfcm
OR
pip install git+git://github.com/olucurious/PyFCM.git
Example:
# Send to single device.
from pyfcm import FCMNotification
push_service = FCMNotification(api_key="<api-key>")
registration_id = "<device registration_id>"
message_title = "Uber update"
message_body = "Hi john, your customized news for today is ready"
result = push_service.notify_single_device(registration_id=registration_id, message_title=message_title, message_body=message_body)
# Send to multiple devices by passing a list of ids.
registration_ids = ["<device registration_id 1>", "<device registration_id 2>", ...]
message_title = "Uber update"
message_body = "Hope you're having fun this weekend, don't forget to check today's news"
result = push_service.notify_multiple_devices(registration_ids=registration_ids, message_title=message_title, message_body=message_body)
print result
You just need to use firebase. Get api key from their and your device_registration_id or device_token and your are all done.
For more you can follow the following link
Upvotes: 2
Reputation: 1
Did you try OneSignal?
They have a simple setup, an easy to use API, and its free
Upvotes: 0