surya raj
surya raj

Reputation: 195

Send notifications to multiple tokens using pyfcm

I am currently using the most recent release of pyfcm, and I noticed a function named async_notify_multiple for sending multiple tokens.

However, it is not functioning.

What is the process for sending multiple notifications?

Upvotes: 0

Views: 162

Answers (1)

Annie Wiley
Annie Wiley

Reputation: 1

For using async_notify_multiple_devices, you just need to send a list of device push tokens along with a dictionary of parameters containing your message data.

The parameters closely match the old notify_multiple_devices.

Here's the parse function for the message request:

def parse_payload(
    self,
    fcm_token=None,
    notification_title=None,
    notification_body=None,
    notification_image=None,
    data_payload=None,
    topic_name=None,
    topic_condition=None,
    android_config=None,
    apns_config=None,
    webpush_config=None,
    fcm_options=None,
    dry_run=False,
):

So, you would send a list of the registration_ids along with a single dictionary containing params like:

 {"notification_title": "Hi, Im a title", "notification_body":"And Im a body"}

Upvotes: 0

Related Questions