push_message.py 831 Bytes
import firebase_admin
from firebase_admin import credentials
from firebase_admin import messaging
from firebase_admin import datetime

cred = credentials.Certificate("./wello_firebase_SDKKey.json")
wello = firebase_admin.initialize_app(cred)
 
topic = 'news'

# See documentation on defining a message payload.
message = messaging.Message(
    android=messaging.AndroidConfig(
        ttl=datetime.timedelta(seconds=3600),
        priority='normal',
        notification=messaging.AndroidNotification(
            title='기성이와',
            body='률이안나',
            icon='',
            color='#f45342',
            sound='default'
        ),
    ),
    data={
        'score': '850',
        'time': '2:45',
    },
    topic=topic
)

response = messaging.send(message)
print('Successfully sent message:', response)