23 lines
621 B
Python
23 lines
621 B
Python
import firebase_admin
|
|
from firebase_admin import credentials, messaging
|
|
|
|
cred = credentials.Certificate("serviceAccountKey.json")
|
|
|
|
try:
|
|
firebase_admin.get_app()
|
|
except:
|
|
firebase_admin.initialize_app(cred)
|
|
|
|
token = "e6V6_DqJQDyiv1OqOqU6Dw:APA91bEwmfMA9aTn71_PO_oSQYTG1Ng1XYTP-oEV1fDvFgrgf25j4xtvIrfwzJxMoNEum4Bj-r78_ZbsHjCm8IlafwO_7gEtujAhPOF6khd5TeOPJWup8xQ"
|
|
|
|
message = messaging.Message(
|
|
notification=messaging.Notification(
|
|
title="⚠️ Tes Notifikasi",
|
|
body="Jika muncul di HP berarti FCM berhasil"
|
|
),
|
|
token=token
|
|
)
|
|
|
|
response = messaging.send(message)
|
|
|
|
print("Berhasil:", response) |