node-red-contrib-line-messaging-api 0.4.1 → 0.4.3
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/.claude/settings.local.json +12 -0
- package/CLAUDE.md +193 -0
- package/README.ja.md +171 -0
- package/README.md +94 -61
- package/nodes/_new/push/push.js +1 -1
- package/nodes/_new/reply/reply.html +6 -7
- package/nodes/_new/reply/reply.js +1 -1
- package/nodes/bloadcast/bloadcast.html +4 -4
- package/nodes/bloadcast/locales/ja/bloadcast.json +9 -0
- package/nodes/config/config.html +105 -31
- package/nodes/config/config.js +2 -2
- package/nodes/config/locales/en-US/config.json +14 -0
- package/nodes/config/locales/ja/config.json +14 -0
- package/nodes/getBotInfo/getBotInfo.html +11 -8
- package/nodes/getBotInfo/locales/en-US/getBotInfo.json +9 -0
- package/nodes/getBotInfo/locales/ja/getBotInfo.json +9 -0
- package/nodes/getProfile/getProfile.html +6 -6
- package/nodes/getProfile/locales/en-US/getProfile.json +8 -0
- package/nodes/getProfile/locales/ja/getProfile.json +8 -0
- package/nodes/limit/limit.html +3 -3
- package/nodes/limit/locales/ja/limit.json +8 -0
- package/nodes/loading/loading.html +7 -10
- package/nodes/loading/locales/ja/loading.json +10 -0
- package/nodes/push/locales/ja/push.json +10 -0
- package/nodes/push/push.html +4 -5
- package/nodes/reply/locales/ja/reply.json +7 -0
- package/nodes/reply/reply.html +5 -5
- package/nodes/webhook/locales/en-US/Webhook.json +8 -0
- package/nodes/webhook/locales/ja/Webhook.json +8 -0
- package/nodes/webhook/webhook.html +2 -2
- package/package.json +11 -7
- package/nodes/_new/notify/notify.html +0 -39
- package/nodes/_new/notify/notify.js +0 -57
- package/nodes/notify/notify.html +0 -42
- package/nodes/notify/notify.js +0 -38
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-line-messaging-api",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Node-RED
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"description": "Node-RED nodes for LINE Messaging API integration. Build LINE Bots easily with visual programming.",
|
|
5
5
|
"main": "line.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,16 +20,20 @@
|
|
|
20
20
|
"Limit": "./nodes/limit/limit.js",
|
|
21
21
|
"getProfile": "./nodes/getProfile/getProfile.js",
|
|
22
22
|
"getBotInfo": "./nodes/getBotInfo/getBotInfo.js",
|
|
23
|
-
"
|
|
23
|
+
"lineConfig": "./nodes/config/config.js",
|
|
24
24
|
"Loading": "./nodes/loading/loading.js",
|
|
25
25
|
"ReplyMessage": "./nodes/reply/reply.js",
|
|
26
|
-
"PushMessage": "./nodes/push/push.js"
|
|
27
|
-
"Notify_New": "./nodes/_new/notify/notify.js",
|
|
28
|
-
"Notify": "./nodes/notify/notify.js"
|
|
26
|
+
"PushMessage": "./nodes/push/push.js"
|
|
29
27
|
}
|
|
30
28
|
},
|
|
31
29
|
"keywords": [
|
|
32
|
-
"node-red"
|
|
30
|
+
"node-red",
|
|
31
|
+
"LINE",
|
|
32
|
+
"bot",
|
|
33
|
+
"messaging",
|
|
34
|
+
"webhook",
|
|
35
|
+
"api",
|
|
36
|
+
"i18n"
|
|
33
37
|
],
|
|
34
38
|
"author": "n0bisuke",
|
|
35
39
|
"license": "Apache 2.0",
|
|
@@ -1,39 +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:1,
|
|
13
|
-
icon: "comment.png",
|
|
14
|
-
align: "right",
|
|
15
|
-
paletteLabel: 'Notify',
|
|
16
|
-
label: () => this.name || 'Notify',
|
|
17
|
-
});
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<script type="text/x-red" data-template-name="Notify_New">
|
|
21
|
-
<div class="form-row">
|
|
22
|
-
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
23
|
-
<input type="text" id="node-input-name" placeholder="Name">
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="form-row">
|
|
27
|
-
<label for="node-input-AccessToken">
|
|
28
|
-
<i class="icon-tag"></i>
|
|
29
|
-
LINE Notify AccessToken
|
|
30
|
-
</label>
|
|
31
|
-
<input type="password" id="node-input-AccessToken" placeholder="LINE Notify AccessToken">
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<p> ※LINE Notifyは2025/3/31でサービス終了となります。利用をやめてPushメッセージなどに移行してください。 https://developers.line.biz/ja/news/2024/10/07/line-notify-will-be-discontinued/ </p>
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<script type="text/x-red" data-help-name="Notify_New">
|
|
38
|
-
<p><a href="https://notify-bot.line.me/my/">LINE Notify</a>でアクセストークンを取得して設定して下さい。</p>
|
|
39
|
-
</script>
|
|
@@ -1,57 +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
|
-
/**
|
|
13
|
-
* 実行時の処理
|
|
14
|
-
*/
|
|
15
|
-
node.on('input', async (msg, send, done) => {
|
|
16
|
-
// const REQUEST_URL = `${LINE_NOTIFY_BASE_URL}${LINE_NOTIFY_PATH}?message=${encodeURI(mes)}&stickerPackageId=1`;
|
|
17
|
-
try {
|
|
18
|
-
const REQUEST_URL = `${LINE_NOTIFY_BASE_URL}${LINE_NOTIFY_PATH}`;
|
|
19
|
-
const mes = msg.payload;
|
|
20
|
-
console.log(mes, typeof mes);
|
|
21
|
-
|
|
22
|
-
let params = {};
|
|
23
|
-
try {
|
|
24
|
-
params = JSON.parse(mes); // JSON形式の場合
|
|
25
|
-
} catch (error) {
|
|
26
|
-
params.message = mes;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const LINE_NOTIFY_TOKEN = node.credentials.AccessToken;
|
|
30
|
-
const REQUEST_OPTIONS = {
|
|
31
|
-
method: 'POST',
|
|
32
|
-
headers: {
|
|
33
|
-
'Content-Type': 'application/json',
|
|
34
|
-
'Authorization': `Bearer ${LINE_NOTIFY_TOKEN}`
|
|
35
|
-
},
|
|
36
|
-
body: new URLSearchParams(params).toString()
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const response = await fetch(REQUEST_URL, REQUEST_OPTIONS);
|
|
40
|
-
const data = await response.json();
|
|
41
|
-
msg.payload = data;
|
|
42
|
-
console.log(data); // { status: 200, message: 'ok' }
|
|
43
|
-
send(msg);
|
|
44
|
-
done();
|
|
45
|
-
} catch (error) {
|
|
46
|
-
console.log(error);
|
|
47
|
-
done(error);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
RED.nodes.registerType("Notify_New", main, {
|
|
53
|
-
credentials: {
|
|
54
|
-
AccessToken: {type:"password"}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
package/nodes/notify/notify.html
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
RED.nodes.registerType('Notify',{
|
|
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
|
-
paletteLabel: 'Notify_old',
|
|
16
|
-
label: function() {
|
|
17
|
-
return this.name||"Notify_old";
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<script type="text/x-red" data-template-name="Notify">
|
|
23
|
-
<div class="form-row">
|
|
24
|
-
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
25
|
-
<input type="text" id="node-input-name" placeholder="Name">
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<div class="form-row">
|
|
29
|
-
<label for="node-input-AccessToken">
|
|
30
|
-
<i class="icon-tag"></i>
|
|
31
|
-
LINE Notify AccessToken
|
|
32
|
-
</label>
|
|
33
|
-
<input type="password" id="node-input-AccessToken" placeholder="LINE Notify AccessToken">
|
|
34
|
-
</div>
|
|
35
|
-
<p> ※LINE Notifyは2025/3/31でサービス終了となります。利用をやめてPushメッセージなどに移行してください。 https://developers.line.biz/ja/news/2024/10/07/line-notify-will-be-discontinued/ </p>
|
|
36
|
-
<p>こちらのノードは旧バージョンになります。Newバージョンの利用を検討してください。</p>
|
|
37
|
-
<p>This node is the old version, please consider using the New version.</p>
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<script type="text/x-red" data-help-name="Notify">
|
|
41
|
-
<p><a href="https://notify-bot.line.me/my/">LINE Notify</a>でアクセストークンを取得して設定して下さい。</p>
|
|
42
|
-
</script>
|
package/nodes/notify/notify.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module.exports = (RED) => {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const axiosBase = require('axios');
|
|
5
|
-
|
|
6
|
-
const main = function(config){
|
|
7
|
-
const node = this;
|
|
8
|
-
RED.nodes.createNode(node, config);
|
|
9
|
-
const LINE_TOKEN = node.credentials.AccessToken;
|
|
10
|
-
const axios = axiosBase.create({
|
|
11
|
-
baseURL: `https://notify-api.line.me`,
|
|
12
|
-
headers: {
|
|
13
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
14
|
-
'Authorization': `Bearer ${LINE_TOKEN}`
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
node.on('input', async (msg, send, done) => {
|
|
19
|
-
const mes = msg.payload;
|
|
20
|
-
try {
|
|
21
|
-
const res = await axios.post(`/api/notify?message=${encodeURI(mes)}`);
|
|
22
|
-
msg.payload = res.data;
|
|
23
|
-
send(msg);
|
|
24
|
-
done();
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.log(error);
|
|
27
|
-
done(error);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
RED.nodes.registerType("Notify", main, {
|
|
34
|
-
credentials: {
|
|
35
|
-
AccessToken: {type:"password"}
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|