我正在尝试使用fcm-push向Android发送通知。我只是不确定如何建立流程。
我已成功让Firebase通过firebase控制台向android发送通知。
只需要fcm-push的示例流程。 感谢。
答案 0 :(得分:0)
经过多次试验和错误 - 我能够想出这个。我做了复制,然后修改了另一个例子 - 不幸的是,我不知道最后一个例子来自我工作的地方(对不起)。这是一个有效的,你可以" import"进入Node Red。请记住将AuthKey更改为您自己的。
[
{
"id": "b765ca96.a1ef58",
"type": "tab",
"label": "Flow 1 _ send notifications to FCM",
"disabled": false,
"info": ""
},
{
"id": "6ecb45a9.373ddc",
"type": "inject",
"z": "b765ca96.a1ef58",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 120,
"y": 40,
"wires": [
[
"aafc8341.84eae"
]
]
},
{
"id": "3aab90c5.6c2a4",
"type": "http request",
"z": "b765ca96.a1ef58",
"name": "http POST to Google FCM",
"method": "POST",
"ret": "txt",
"url": "https:\/\/fcm.googleapis.com\/fcm\/send",
"tls": "",
"x": 180,
"y": 220,
"wires": [
[
"8d1dc739.0b7ac8"
]
]
},
{
"id": "aafc8341.84eae",
"type": "function",
"z": "b765ca96.a1ef58",
"name": "set payload and headers",
"func": "msg.payload = {\"to\": \"\/topics\/news\",\"data\": {\"message\": \"This is a FCM Topic Message!\"},\"notification\":{\"body\" : \"some_message\"}};\nmsg.headers = {\"Authorization\": \"key=BDzaSyCN932874928374-d1Jz3Rkcvbcr4\"};\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 170,
"y": 120,
"wires": [
[
"3aab90c5.6c2a4"
]
]
},
{
"id": "8d1dc739.0b7ac8",
"type": "debug",
"z": "b765ca96.a1ef58",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"complete": "false",
"x": 290,
"y": 340,
"wires": [
]
}
]