FCM Library

This library is used to send push notifications to devices using Firebase Cloud Messaging.

 

Import

To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import FCM

 

Send push notification 

FCM.send_fcm_notification(keyregistration_idsbodysound=None, badge=None, title=None, icon=None, tag=None, color=None, click_action=None, body_loc_key=None, body_loc_args=None, title_loc_key=None, title_loc_args=None, data=None, priority='high'))

Send an FCM notification to the devices identified by registration_ids. For parameter definitions refer to the Downstream HTTP JSON tables.

Credit cost: 1

Parameters

  • keystr|unicode FCM API key
  • registration_idslist see Table 1
  • bodystr|unicode see Table 2a/b
  • soundstr|unicode see Table 2a/b
  • badgestr|unicode see Table 2a/b
  • titlestr|unicode see Table 2a/b
  • iconstr|unicode see Table 2a/b
  • tagstr|unicode see Table 2a/b
  • colorstr|unicode see Table 2a/b
  • click_actionstr|unicode see Table 2a/b
  • body_loc_keystr|unicode see Table 2a/b
  • body_loc_argsstr|unicode see Table 2a/b
  • title_loc_keystr|unicode see Table 2a/b
  • title_loc_argsstr|unicode see Table 2a/b
  • datastr|unicode see Table 1
  • prioritystr|unicode see Table 1

Return Value

None

Example

  • Sample Code:
    • import FCM
      
      FCM.send_fcm_notification(app_key,[FCM_token],notification['message'], sound="chime”)

Exceptions