node-red-contrib-line-messaging-api 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +3 -4
- package/nodes/_new/notify/notify.html +0 -38
- package/nodes/_new/notify/notify.js +0 -47
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ AdminタブからInstall
|
|
|
53
53
|
* [npm](https://www.npmjs.com/package/node-red-contrib-line-messaging-api)
|
|
54
54
|
|
|
55
55
|
## release
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
- 2021/8/1: Reply Messageが画像に対応(thanks [@ukkz](https://github.com/ukkz))
|
|
58
58
|
- 2020/12/17: Bloadcast Messageに対応、Reply MessageがFlex Messageに対応(thanks [@gaomar](https://github.com/gaomar))
|
|
59
59
|
- 2019/2/13: PUSH MessageとLINE Notify対応
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-line-messaging-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Node-REDでLINE Botが作れます。",
|
|
5
5
|
"main": "line.js",
|
|
6
6
|
"repository": {
|
|
@@ -18,11 +18,10 @@
|
|
|
18
18
|
"PushMessage": "./nodes/push/push.js",
|
|
19
19
|
"BloadcastMessage": "./nodes/bloadcast/bloadcast.js",
|
|
20
20
|
"Limit": "./nodes/limit/limit.js",
|
|
21
|
-
"Notify": "./nodes/notify/notify.js"
|
|
22
|
-
"Notify_new": "./nodes/_new/notify/notify.js"
|
|
21
|
+
"Notify": "./nodes/notify/notify.js"
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
|
-
"keywords": [],
|
|
24
|
+
"keywords": ["node-red"],
|
|
26
25
|
"author": "n0bisuke",
|
|
27
26
|
"license": "Apache 2.0",
|
|
28
27
|
"dependencies": {
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
RED.nodes.registerType('Notify_New',{
|
|
3
|
-
category: 'LINE',
|
|
4
|
-
color: '#1ad823',
|
|
5
|
-
defaults: {
|
|
6
|
-
name: {value:""},
|
|
7
|
-
},
|
|
8
|
-
credentials: {
|
|
9
|
-
AccessToken: { type: "password", required: true }
|
|
10
|
-
},
|
|
11
|
-
inputs:1,
|
|
12
|
-
outputs:0,
|
|
13
|
-
icon: "comment.png",
|
|
14
|
-
align: "right",
|
|
15
|
-
label: function() {
|
|
16
|
-
return this.name||"Notify_New";
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<script type="text/x-red" data-template-name="Notify_New">
|
|
22
|
-
<div class="form-row">
|
|
23
|
-
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
24
|
-
<input type="text" id="node-input-name" placeholder="Name">
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<div class="form-row">
|
|
28
|
-
<label for="node-input-AccessToken">
|
|
29
|
-
<i class="icon-tag"></i>
|
|
30
|
-
LINE Notify AccessToken
|
|
31
|
-
</label>
|
|
32
|
-
<input type="password" id="node-input-AccessToken" placeholder="LINE Notify AccessToken">
|
|
33
|
-
</div>
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<script type="text/x-red" data-help-name="Notify">
|
|
37
|
-
<p><a href="https://notify-bot.line.me/my/">LINE Notify</a>でアクセストークンを取得して設定して下さい。</p>
|
|
38
|
-
</script>
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
module.exports = (RED) => {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const LINE_NOTIFY_BASE_URL = 'https://notify-api.line.me';
|
|
5
|
-
const LINE_NOTIFY_PATH = '/api/notify';
|
|
6
|
-
let REQUEST_OPTIONS = {};
|
|
7
|
-
|
|
8
|
-
const main = function(config){
|
|
9
|
-
const node = this;
|
|
10
|
-
RED.nodes.createNode(node, config);
|
|
11
|
-
|
|
12
|
-
const LINE_NOTIFY_TOKEN = node.credentials.AccessToken;
|
|
13
|
-
REQUEST_OPTIONS = {
|
|
14
|
-
method: 'POST',
|
|
15
|
-
headers: {
|
|
16
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
17
|
-
'Authorization': `Bearer ${LINE_NOTIFY_TOKEN}`
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 実行時の処理
|
|
24
|
-
*/
|
|
25
|
-
node.on('input', async (msg, send, done) => {
|
|
26
|
-
const mes = msg.payload;
|
|
27
|
-
const REQUEST_URL = `${LINE_NOTIFY_BASE_URL}${LINE_NOTIFY_PATH}?message=${encodeURI(mes)}`;
|
|
28
|
-
try {
|
|
29
|
-
const response = await fetch(REQUEST_URL, REQUEST_OPTIONS);
|
|
30
|
-
const data = await response.json();
|
|
31
|
-
msg.payload = data;
|
|
32
|
-
console.log(data); // { status: 200, message: 'ok' }
|
|
33
|
-
send(msg);
|
|
34
|
-
done();
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.log(error);
|
|
37
|
-
done(error);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
RED.nodes.registerType("Notify_New", main, {
|
|
43
|
-
credentials: {
|
|
44
|
-
AccessToken: {type:"password"}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|