Skip to content

Instantly share code, notes, and snippets.

@jackrobotics
Last active April 16, 2020 08:49
Show Gist options
  • Save jackrobotics/bec52fe425c32fb4603740c828bf7a3d to your computer and use it in GitHub Desktop.
Save jackrobotics/bec52fe425c32fb4603740c828bf7a3d to your computer and use it in GitHub Desktop.
[
{
"id": "772c7624.918b58",
"type": "http request",
"z": "44982414.c5c8fc",
"name": "line notify",
"method": "POST",
"ret": "obj",
"paytoqs": false,
"url": "https://notify-api.line.me/api/notify",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1280,
"y": 340,
"wires": [
[]
]
},
{
"id": "e18391da.0bf45",
"type": "inject",
"z": "44982414.c5c8fc",
"name": "call function",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 690,
"y": 340,
"wires": [
[
"f6df982d.6ef068"
]
]
},
{
"id": "f6df982d.6ef068",
"type": "http request",
"z": "44982414.c5c8fc",
"name": "get data",
"method": "GET",
"ret": "obj",
"paytoqs": false,
"url": "https://covid19.th-stat.com/api/open/today",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 840,
"y": 340,
"wires": [
[
"48367265.a38d9c",
"25966764.37d4c8"
]
]
},
{
"id": "48367265.a38d9c",
"type": "debug",
"z": "44982414.c5c8fc",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 990,
"y": 300,
"wires": []
},
{
"id": "15e4aa74.5b4556",
"type": "function",
"z": "44982414.c5c8fc",
"name": "line token",
"func": "msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer o0Nbpw2NcxlnTaF65f0l2XaLs7iXBRoug13heVbHFyQ'};\nmsg.payload = {message:msg.payload};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1140,
"y": 340,
"wires": [
[
"772c7624.918b58"
]
]
},
{
"id": "25966764.37d4c8",
"type": "function",
"z": "44982414.c5c8fc",
"name": "message",
"func": "var message = \"\\nอับเดทล่าสุด: \"+msg.payload.UpdateDate+\"\\n\";\nmessage += \"ผู้ติดเชื้อสะสม: \"+msg.payload.Confirmed+\" ( \"+msg.payload.NewConfirmed+\" )\\n\";\nmessage += \"หายแล้ว: \"+msg.payload.Recovered+\" ( \"+msg.payload.NewRecovered+\" )\\n\";\nmessage += \"รักษาอยู่: \"+msg.payload.Hospitalized+\" ( \"+msg.payload.NewHospitalized+\" )\\n\";\nmessage += \"เสียชีวิต: \"+msg.payload.Deaths+\" ( \"+msg.payload.NewDeaths+\" )\\n\";\n\nmsg.payload = message;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1000,
"y": 340,
"wires": [
[
"15e4aa74.5b4556"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment