node-red-contrib-line-messaging-api 0.4.2 → 0.4.4
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 +23 -1
- package/README.ja.md +172 -0
- package/README.md +95 -61
- 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 +25 -13
- 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/markAsRead/locales/ja/markAsRead.json +8 -0
- package/nodes/markAsRead/markAsRead.html +44 -0
- package/nodes/markAsRead/markAsRead.js +57 -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/reply/reply.js +10 -4
- 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 +13 -9
- 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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"validation": {
|
|
3
|
+
"botNameRequired": "Bot Name is required!",
|
|
4
|
+
"channelSecretRequired": "Channel Secret is required!",
|
|
5
|
+
"channelAccessTokenRequired": "Channel Access Token is required!"
|
|
6
|
+
},
|
|
7
|
+
"label": {
|
|
8
|
+
"botName": "Bot Name",
|
|
9
|
+
"channelSecret": "Channel Secret",
|
|
10
|
+
"channelAccessToken": "Channel Access Token",
|
|
11
|
+
"botIcon": "Bot Icon",
|
|
12
|
+
"fetchBotInfo": "Fetch Bot Name & Icon"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"validation": {
|
|
3
|
+
"botNameRequired": "ボット名は必須です!",
|
|
4
|
+
"channelSecretRequired": "チャンネルシークレットは必須です!",
|
|
5
|
+
"channelAccessTokenRequired": "チャンネルアクセストークンは必須です!"
|
|
6
|
+
},
|
|
7
|
+
"label": {
|
|
8
|
+
"botName": "ボット名",
|
|
9
|
+
"channelSecret": "チャンネルシークレット",
|
|
10
|
+
"channelAccessToken": "チャンネルアクセストークン",
|
|
11
|
+
"botIcon": "ボットアイコン",
|
|
12
|
+
"fetchBotInfo": "Bot名&アイコンを取得"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -21,24 +21,27 @@
|
|
|
21
21
|
<div class="form-row">
|
|
22
22
|
<label for="node-input-name">
|
|
23
23
|
<i class="fa fa-tag"></i>
|
|
24
|
-
<span data-i18n="
|
|
24
|
+
<span data-i18n="getBotInfo.label.name">名前</span>
|
|
25
25
|
</label>
|
|
26
|
-
<input type="text" id="node-input-name"
|
|
26
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<!-- LINE Config -->
|
|
30
30
|
<div class="form-row">
|
|
31
31
|
<label for="node-input-lineConfig">
|
|
32
32
|
<i class="fa fa-tag"></i>
|
|
33
|
-
LINE Bot
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
<span data-i18n="getBotInfo.label.lineConfig">LINE Bot設定</span>
|
|
34
|
+
</label>
|
|
35
|
+
<input type="text" id="node-input-lineConfig">
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- Bot情報取得ボタン -->
|
|
39
|
+
<div class="form-row">
|
|
40
|
+
<button type="button" id="node-getbotinfo-fetch"><span data-i18n="getBotInfo.label.fetchBotInfo">Bot情報を取得</span></button>
|
|
36
41
|
</div>
|
|
37
42
|
|
|
38
43
|
</script>
|
|
39
44
|
|
|
40
45
|
<script type="text/html" data-help-name="getBotInfo">
|
|
41
|
-
<p>BOT
|
|
46
|
+
<p>Gets the BOT information!</p>
|
|
42
47
|
</script>
|
|
43
|
-
|
|
44
|
-
|
|
@@ -21,24 +21,24 @@
|
|
|
21
21
|
<div class="form-row">
|
|
22
22
|
<label for="node-input-name">
|
|
23
23
|
<i class="fa fa-tag"></i>
|
|
24
|
-
<span data-i18n="
|
|
24
|
+
<span data-i18n="getProfile.label.name">名前</span>
|
|
25
25
|
</label>
|
|
26
|
-
<input type="text" id="node-input-name"
|
|
26
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<!-- LINE Config -->
|
|
30
30
|
<div class="form-row">
|
|
31
31
|
<label for="node-input-lineConfig">
|
|
32
32
|
<i class="fa fa-tag"></i>
|
|
33
|
-
LINE Bot
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
<span data-i18n="getProfile.label.lineConfig">LINE Bot設定</span>
|
|
34
|
+
</label>
|
|
35
|
+
<input type="text" id="node-input-lineConfig">
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
</script>
|
|
39
39
|
|
|
40
40
|
<script type="text/html" data-help-name="getProfile">
|
|
41
|
-
<p
|
|
41
|
+
<p>Gets the user profile information.</p>
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
|
package/nodes/limit/limit.html
CHANGED
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
<script type="text/html" data-template-name="Limit">
|
|
22
22
|
<!-- 名前 -->
|
|
23
23
|
<div class="form-row">
|
|
24
|
-
<label for="node-input-name"><i class="icon-tag"></i>
|
|
24
|
+
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="limit.label.name">名前</span></label>
|
|
25
25
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
<div class="form-row">
|
|
29
29
|
<label for="node-input-AccessToken">
|
|
30
30
|
<i class="icon-tag"></i>
|
|
31
|
-
|
|
31
|
+
<span data-i18n="limit.label.accessToken">チャンネルアクセストークン</span>
|
|
32
32
|
</label>
|
|
33
33
|
<input type="password" id="node-input-AccessToken" placeholder="LINE Limit AccessToken">
|
|
34
34
|
</div>
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<script type="text/x-red" data-help-name="Limit">
|
|
38
|
-
<p
|
|
38
|
+
<p>Returns the current month's message quota limits.</p>
|
|
39
39
|
</script>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script type="text/html" data-template-name="Loading">
|
|
22
22
|
<div class="form-row">
|
|
23
|
-
<label for="node-input-name"><i class="icon-tag"></i>
|
|
23
|
+
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="loading.label.name">名前</span></label>
|
|
24
24
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
25
25
|
</div>
|
|
26
26
|
|
|
@@ -28,20 +28,19 @@
|
|
|
28
28
|
<div class="form-row">
|
|
29
29
|
<label for="node-input-lineConfig">
|
|
30
30
|
<i class="fa fa-tag"></i>
|
|
31
|
-
LINE Bot
|
|
32
|
-
<span data-i18n="getProfile.label.lineConfig"></span>
|
|
31
|
+
<span data-i18n="loading.label.lineConfig">LINE Bot設定</span>
|
|
33
32
|
</label> <input type="text" id="node-input-lineConfig" data-i18n="[placeholder]getProfile.desc.lineConfig">
|
|
34
33
|
</div>
|
|
35
34
|
|
|
36
35
|
<!-- chat ID / User ID -->
|
|
37
36
|
<div class="form-row">
|
|
38
|
-
<label for="node-input-targetId"><i class="icon-tag"></i>
|
|
37
|
+
<label for="node-input-targetId"><i class="icon-tag"></i> <span data-i18n="loading.label.targetId">ユーザーID</span></label>
|
|
39
38
|
<input type="text" id="node-input-targetId" placeholder="User Id">
|
|
40
39
|
</div>
|
|
41
40
|
|
|
42
41
|
<div class="form-row">
|
|
43
42
|
<label for="node-input-loadingSeconds">
|
|
44
|
-
<i class="icon-timer"></i>
|
|
43
|
+
<i class="icon-timer"></i> <span data-i18n="loading.label.loadingSeconds">ローディング秒数</span>
|
|
45
44
|
</label>
|
|
46
45
|
<select id="node-input-loadingSeconds">
|
|
47
46
|
<option value="5">5</option>
|
|
@@ -60,13 +59,11 @@
|
|
|
60
59
|
</div>
|
|
61
60
|
|
|
62
61
|
<p>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
UからはじまるユーザーIDのみ(個別チャット)です。
|
|
66
|
-
詳細は<a href="https://developers.line.biz/ja/reference/messaging-api/#display-a-loading-indicator" target="_blank">公式ドキュメント</a>を参照下さい。
|
|
62
|
+
Displays a loading indicator for the specified duration. Currently supports individual chats only (user IDs starting with 'U').
|
|
63
|
+
See <a href="https://developers.line.biz/ja/reference/messaging-api/#display-a-loading-indicator" target="_blank">official documentation</a> for details.
|
|
67
64
|
</p>
|
|
68
65
|
</script>
|
|
69
66
|
|
|
70
67
|
<script type="text/html" data-help-name="Loading">
|
|
71
|
-
<p
|
|
68
|
+
<p>Displays a loading indicator animation to LINE users.</p>
|
|
72
69
|
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
RED.nodes.registerType('markAsRead', {
|
|
3
|
+
category: 'LINE',
|
|
4
|
+
color: '#01B301',
|
|
5
|
+
defaults: {
|
|
6
|
+
name: {value: ''},
|
|
7
|
+
lineConfig: {value: "", type:"lineConfig", required:true},
|
|
8
|
+
},
|
|
9
|
+
inputs: 1,
|
|
10
|
+
outputs: 1,
|
|
11
|
+
icon: "check.png",
|
|
12
|
+
align: 'right',
|
|
13
|
+
label: function () {
|
|
14
|
+
return this.name || 'markAsRead';
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script type="text/html" data-template-name="markAsRead">
|
|
20
|
+
<!-- 名前 -->
|
|
21
|
+
<div class="form-row">
|
|
22
|
+
<label for="node-input-name">
|
|
23
|
+
<i class="fa fa-tag"></i>
|
|
24
|
+
<span data-i18n="markAsRead.label.name">名前</span>
|
|
25
|
+
</label>
|
|
26
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- LINE Config -->
|
|
30
|
+
<div class="form-row">
|
|
31
|
+
<label for="node-input-lineConfig">
|
|
32
|
+
<i class="fa fa-tag"></i>
|
|
33
|
+
<span data-i18n="markAsRead.label.lineConfig">LINE Bot設定</span>
|
|
34
|
+
</label>
|
|
35
|
+
<input type="text" id="node-input-lineConfig">
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<script type="text/html" data-help-name="markAsRead">
|
|
41
|
+
<p>Gets the user profile information.</p>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module.exports = (RED) => {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const line = require('@line/bot-sdk');
|
|
5
|
+
|
|
6
|
+
const main = function(config){
|
|
7
|
+
const node = this;
|
|
8
|
+
RED.nodes.createNode(node, config);
|
|
9
|
+
|
|
10
|
+
let lineconfig = {};
|
|
11
|
+
try {
|
|
12
|
+
lineconfig = require('../../env');
|
|
13
|
+
} catch (error) {
|
|
14
|
+
node.lineConfig = RED.nodes.getNode(config.lineConfig); //共通のlineConfigを取得
|
|
15
|
+
|
|
16
|
+
lineconfig = {
|
|
17
|
+
channelSecret: node.lineConfig.credentials.LineChannelSecret,
|
|
18
|
+
channelAccessToken: node.lineConfig.credentials.LineChannelAccessToken
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if(lineconfig.channelAccessToken === undefined || lineconfig.channelAccessToken === '') {
|
|
22
|
+
console.error('LINE token not found');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const client = new line.messagingApi.MessagingApiClient(lineconfig);
|
|
26
|
+
|
|
27
|
+
// ここでLINE APIを呼び出す処理
|
|
28
|
+
node.on('input', async(msg, send, done) => {
|
|
29
|
+
// console.log("markAsReadToken:");
|
|
30
|
+
// console.log(msg.line.event, send);
|
|
31
|
+
try {
|
|
32
|
+
const markAsReadToken = msg.line?.event?.message?.markAsReadToken;
|
|
33
|
+
const res = await client.markMessagesAsReadByToken({ markAsReadToken: markAsReadToken });
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if(Object.keys(res).length !== 0) { // 正常だと{}が返ってくる
|
|
37
|
+
throw new Error(`Marked as read failed.`);
|
|
38
|
+
}else{
|
|
39
|
+
// console.log("Marked as read successfully.");
|
|
40
|
+
// 成功した場合の処理 そのままpayloadを返す
|
|
41
|
+
msg.payload = msg.payload || {};
|
|
42
|
+
send(msg);
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
// console.error(error.body);
|
|
46
|
+
node.error(error.body, msg.payload);
|
|
47
|
+
msg.payload = error.body; //エラーメッセージをDebugに表示するためにmsg.payloadにセット
|
|
48
|
+
send(msg);
|
|
49
|
+
done(error);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// console.log("Message received:", msg.payload);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
RED.nodes.registerType("markAsRead", main);
|
|
57
|
+
}
|
package/nodes/push/push.html
CHANGED
|
@@ -23,26 +23,25 @@
|
|
|
23
23
|
|
|
24
24
|
<script type="text/x-red" data-template-name="PushMessage">
|
|
25
25
|
<div class="form-row">
|
|
26
|
-
<label for="node-input-name"><i class="icon-tag"></i>
|
|
26
|
+
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="push.label.name">名前</span></label>
|
|
27
27
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
30
|
<div class="form-row">
|
|
31
|
-
<label for="node-input-channelSecret"><i class="icon-tag"></i>
|
|
31
|
+
<label for="node-input-channelSecret"><i class="icon-tag"></i> <span data-i18n="push.label.channelSecret">チャンネルシークレット</span></label>
|
|
32
32
|
<input type="password" id="node-input-channelSecret" placeholder="ChannelSecret">
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<div class="form-row">
|
|
36
|
-
<label for="node-input-channelAccessToken"><i class="icon-tag"></i>
|
|
36
|
+
<label for="node-input-channelAccessToken"><i class="icon-tag"></i> <span data-i18n="push.label.channelAccessToken">チャンネルアクセストークン</span></label>
|
|
37
37
|
<input type="password" id="node-input-channelAccessToken" placeholder="ChannelAccessToken">
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<div class="form-row">
|
|
41
|
-
<label for="node-input-targetId"><i class="icon-tag"></i>
|
|
41
|
+
<label for="node-input-targetId"><i class="icon-tag"></i> <span data-i18n="push.label.targetId">ユーザーIDまたはグループID</span></label>
|
|
42
42
|
<input type="text" id="node-input-targetId" placeholder="User Id or Group ID">
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
|
-
<p>こちらのノードは旧バージョンになります。Newバージョンの利用を検討してください。</p>
|
|
46
45
|
<p>This node is the old version, please consider using the New version.</p>
|
|
47
46
|
</script>
|
|
48
47
|
|
package/nodes/reply/reply.html
CHANGED
|
@@ -23,26 +23,26 @@
|
|
|
23
23
|
|
|
24
24
|
<script type="text/x-red" data-template-name="ReplyMessage">
|
|
25
25
|
<div class="form-row">
|
|
26
|
-
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
26
|
+
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="common.label.name">Name</span></label>
|
|
27
27
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
30
|
<div class="form-row">
|
|
31
|
-
<label for="node-input-channelSecret"><i class="icon-tag"></i> Secret</label>
|
|
31
|
+
<label for="node-input-channelSecret"><i class="icon-tag"></i> <span data-i18n="lineConfig.label.channelSecret">Secret</span></label>
|
|
32
32
|
<input type="password" id="node-input-channelSecret" placeholder="ChannelSecret">
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<div class="form-row">
|
|
36
|
-
<label for="node-input-channelAccessToken"><i class="icon-tag"></i> AccessToken</label>
|
|
36
|
+
<label for="node-input-channelAccessToken"><i class="icon-tag"></i> <span data-i18n="lineConfig.label.channelAccessToken">AccessToken</span></label>
|
|
37
37
|
<input type="password" id="node-input-channelAccessToken" placeholder="ChannelAccessToken">
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<div class="form-row">
|
|
41
|
-
<label for="node-input-replyMessage"><i class="icon-tag"></i> ReplyMessage</label>
|
|
41
|
+
<label for="node-input-replyMessage"><i class="icon-tag"></i> <span data-i18n="reply.label.message">ReplyMessage</span></label>
|
|
42
42
|
<input type="text" id="node-input-replyMessage" placeholder="static text message here">
|
|
43
43
|
</div>
|
|
44
44
|
</script>
|
|
45
45
|
|
|
46
46
|
<script type="text/x-red" data-help-name="ReplyMessage">
|
|
47
|
-
<p>
|
|
47
|
+
<p>Sends reply messages to LINE users using reply tokens.</p>
|
|
48
48
|
</script>
|
package/nodes/reply/reply.js
CHANGED
|
@@ -10,10 +10,16 @@ module.exports = (RED) => {
|
|
|
10
10
|
try {
|
|
11
11
|
lineconfig = require('../../env');
|
|
12
12
|
} catch (error) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
const globalLineConfig = node.context().global.get("lineConfig");
|
|
14
|
+
if (globalLineConfig) {
|
|
15
|
+
lineconfig = globalLineConfig;
|
|
16
|
+
} else {
|
|
17
|
+
lineconfig = {
|
|
18
|
+
channelSecret: node.credentials.channelSecret,
|
|
19
|
+
channelAccessToken: node.credentials.channelAccessToken
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
if (lineconfig.channelSecret === '' || lineconfig.channelAccessToken === '') {
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
|
|
46
46
|
<script type="text/x-red" data-template-name="Webhook">
|
|
47
47
|
<div class="form-row">
|
|
48
|
-
<label for="node-input-url"><i class="fa fa-globe"></i>
|
|
48
|
+
<label for="node-input-url"><i class="fa fa-globe"></i> <span data-i18n="Webhook.label.path">パス</span></label>
|
|
49
49
|
<input id="node-input-url" type="text" placeholder="/webhook">
|
|
50
50
|
</div>
|
|
51
51
|
<div class="form-row">
|
|
52
|
-
<label for="node-input-name"><i class="fa fa-tag"></i>
|
|
52
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="Webhook.label.name">名前</span></label>
|
|
53
53
|
<input id="node-input-name" type="text" placeholder="Name">
|
|
54
54
|
</div>
|
|
55
55
|
</script>
|
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.4",
|
|
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,23 +20,27 @@
|
|
|
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
26
|
"PushMessage": "./nodes/push/push.js",
|
|
27
|
-
"
|
|
28
|
-
"Notify": "./nodes/notify/notify.js"
|
|
27
|
+
"MarkAsRead": "./nodes/markAsRead/markAsRead.js"
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
30
|
"keywords": [
|
|
32
|
-
"node-red"
|
|
31
|
+
"node-red",
|
|
32
|
+
"LINE",
|
|
33
|
+
"bot",
|
|
34
|
+
"messaging",
|
|
35
|
+
"webhook",
|
|
36
|
+
"api",
|
|
37
|
+
"i18n"
|
|
33
38
|
],
|
|
34
39
|
"author": "n0bisuke",
|
|
35
40
|
"license": "Apache 2.0",
|
|
36
41
|
"dependencies": {
|
|
37
|
-
"@line/bot-sdk": "^
|
|
42
|
+
"@line/bot-sdk": "^10.5.0",
|
|
38
43
|
"body-parser": "^1.19.1",
|
|
39
|
-
"cors": "^2.8.5"
|
|
40
|
-
"express": "^4.17.1"
|
|
44
|
+
"cors": "^2.8.5"
|
|
41
45
|
}
|
|
42
46
|
}
|
|
@@ -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
|
-
}
|