Skip to content

nawah-io/gateway_fcm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nawah Gateway for Firebase Cloud Messaging (FCM)

This repo is a Nawah Package that allows developers to integrate FCM into Nawah apps using Gateway Controller.

How-to

  1. From your app directory run: nawah packages add gateway_fcm
  2. Add fcm Var to nawah_app.py App Config:
vars = {
    'fcm': {'token': 'FCM_API_TOKEN'}
}
  1. fcm gateway requires following arguments:
    1. registration_id: Target device registration identifier. Type str.
    2. message_title: Message title. Type str.
    3. message_body: Message body. Type str.
    4. data_message: Additional payload data to be sent with the message. Type dict.
  2. fcm gateway accepts optional argument, namely fcm_auth, replicating fcm for dynamic FCM API credentials.
  3. Use fcm gateway using Nawah Gateway Controller:
from nawah.gateway import Gateway

Gateway.send(gateway='fcm', registration_id=registration_id, message_title=message_title, message_body=message_body, data_message=data_message)