node-red-contrib-line-messaging-api 0.4.2 → 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 +23 -1
- package/README.ja.md +171 -0
- package/README.md +94 -61
- package/nodes/_new/reply/reply.html +6 -7
- 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/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/CLAUDE.md
CHANGED
|
@@ -168,4 +168,26 @@ nodes/
|
|
|
168
168
|
- **Reply token expired**: Reply tokens are single-use and time-limited
|
|
169
169
|
- **Message format errors**: Ensure JSON structure matches LINE API specs
|
|
170
170
|
|
|
171
|
-
This documentation provides AI assistants with comprehensive context for maintaining and extending this LINE Bot Node-RED integration package.
|
|
171
|
+
This documentation provides AI assistants with comprehensive context for maintaining and extending this LINE Bot Node-RED integration package.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 【重要】getBotInfoノードの多言語化(i18n)設計方針まとめ
|
|
176
|
+
|
|
177
|
+
- UI要素のi18nは `getBotInfo.label.xxx` 形式でJSONファイルに記述し、テンプレートも同じ参照形式で統一する
|
|
178
|
+
- 例: `<span data-i18n="getBotInfo.label.lineConfig">LINE Bot設定</span>`
|
|
179
|
+
- JSON構造例:
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"getBotInfo": {
|
|
183
|
+
"label": {
|
|
184
|
+
"name": "名前",
|
|
185
|
+
"lineConfig": "LINE Bot設定",
|
|
186
|
+
"fetchBotInfo": "Bot情報を取得"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
- `data-help-name`セクションのヘルプテキストはJSONからは参照できないため、英語で直接HTMLに記述する
|
|
192
|
+
- ヘルプの多言語化が必要な場合は、locales/ja/getBotInfo.html等を用意しHTML分離方式で対応する
|
|
193
|
+
- `data-i18n`は`data-template-name`セクション内のみ有効、`data-help-name`内では動作しない
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# node-red-contrib-line-messaging-api
|
|
2
|
+
|
|
3
|
+
[English version](README.md)
|
|
4
|
+
|
|
5
|
+
LINE Messaging APIのNode-REDノードです。
|
|
6
|
+
Node-REDのビジュアルプログラミングインターフェースで簡単にLINE Botを構築できます。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## このプロジェクトについて
|
|
11
|
+
|
|
12
|
+
このパッケージはLINE Messaging APIと統合するためのNode-REDノードを提供し、Node-REDのビジュアルフローエディターを使用してLINE Botを作成できます。Webhook、メッセージ送信、LINE Botイベントの処理をシンプルなドラッグアンドドロップノードで実現できます。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## インストール
|
|
17
|
+
|
|
18
|
+
Node-REDのルートディレクトリで以下のコマンドを実行してください:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install node-red-contrib-line-messaging-api
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
またはNode-REDのパレットマネージャーを使用:
|
|
25
|
+
|
|
26
|
+
1. Node-REDメニューを開く
|
|
27
|
+
2. 「パレットの管理」を選択
|
|
28
|
+
3. 「ノードを追加」タブをクリック
|
|
29
|
+
4. 「line-messaging-api」を検索
|
|
30
|
+
5. インストールをクリック
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 設定
|
|
35
|
+
|
|
36
|
+
### LINE Bot設定ノード
|
|
37
|
+
|
|
38
|
+
LINE Botの認証情報(チャンネルシークレット、チャンネルアクセストークン)を保存する設定ノードです。このバックグラウンドノードはエディターには表示されず、ReplyやPushノードの設定UIからアクセスできます。
|
|
39
|
+
|
|
40
|
+
> 
|
|
41
|
+
|
|
42
|
+
作成したLINE Bot設定は複数のReplyノードやPushノードで共有できます。
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 利用できるAPIと利用イメージ
|
|
47
|
+
|
|
48
|
+
### Webhook & Reply Message
|
|
49
|
+
|
|
50
|
+
1. Webhookノードを配置し、ダブルクリックで設定を開き、指定した `/path` と自身のホスト名の組み合わせ(Webhook URL)を、LINE Developersであらかじめ作成したMessaging APIに登録します。
|
|
51
|
+
2. ReplyMessageノードを配置し、チャネルのシークレットとアクセストークンを設定します。
|
|
52
|
+
3. WebhookノードとReplyMessageノードを接続してLINEにメッセージを送るとオウム返しBotができます。
|
|
53
|
+
[](https://gyazo.com/7da2dbecfc69515edf852cf7a26d9196)
|
|
54
|
+
4. WebhookノードとReplyMessageノードの中間で `msg.payload` をうまく作成すると様々なメッセージが送れます。文字列を指定すると通常のテキストメッセージに、[LINEで定義されているメッセージオブジェクト](https://developers.line.biz/ja/reference/messaging-api/#message-objects)を指定すればそのメッセージを返信することができます。
|
|
55
|
+
|
|
56
|
+
### Push Message
|
|
57
|
+
|
|
58
|
+
Pushメッセージを送るときにmsg.payloadにテキストを入れることでテキストメッセージの送信ができます。
|
|
59
|
+
|
|
60
|
+
> 
|
|
61
|
+
|
|
62
|
+
#### テキストメッセージv2でユーザーにメンション
|
|
63
|
+
|
|
64
|
+
Pushメッセージを送るときにmsg.payloadに`{hoge}`などのテキストを入れつつ、msg.substitutionを設定することでテキストメッセージv2を使ってユーザーにメンションすることができます。
|
|
65
|
+
|
|
66
|
+
- msg.payload: `Welcome, {user1}! {laugh}\n{everyone} There is a newcomer!`
|
|
67
|
+
- msg.substitution:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{"user1": {"type": "mention", "mentionee": {"type": "user", "userId": "Uxxxxxxxxxxxx"}},"laugh": {"type": "emoji","productId": "670e0cce840a8236ddd4ee4c","emojiId": "002"},"everyone": {"type": "mention","mentionee": {"type": "all"}}}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> 
|
|
74
|
+
|
|
75
|
+
#### 任意のメッセージ
|
|
76
|
+
|
|
77
|
+
msg.payloadに配列や[メッセージオブジェクト](https://developers.line.biz/ja/reference/messaging-api/#message-objects)を設定することで任意のメッセージを送信できます。
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
msg.payload = [
|
|
81
|
+
{
|
|
82
|
+
type: "text",
|
|
83
|
+
text: "hogehoge",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
type: "image",
|
|
87
|
+
originalContentUrl: 'https://i.gyazo.com/e772c3b48a07716226f7184d7f417cda.png',
|
|
88
|
+
previewImageUrl: 'https://i.gyazo.com/e772c3b48a07716226f7184d7f417cda.png'
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
return msg;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Broadcast Message
|
|
96
|
+
|
|
97
|
+
友達全員にメッセージ配信します。
|
|
98
|
+
|
|
99
|
+
> 
|
|
100
|
+
|
|
101
|
+
### Loading
|
|
102
|
+
|
|
103
|
+
ローディングアニメーションを表示させます。
|
|
104
|
+
|
|
105
|
+
> 
|
|
106
|
+
> https://developers.line.biz/ja/reference/messaging-api/#display-a-loading-indicator
|
|
107
|
+
|
|
108
|
+
### getProfile
|
|
109
|
+
|
|
110
|
+
ユーザーの情報を取得します。
|
|
111
|
+
https://developers.line.biz/ja/reference/messaging-api/#get-profile
|
|
112
|
+
|
|
113
|
+
### getBotInfo
|
|
114
|
+
|
|
115
|
+
BOTの情報を取得します。
|
|
116
|
+
https://developers.line.biz/ja/reference/messaging-api/#get-bot-info
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## ノードタイプ
|
|
121
|
+
|
|
122
|
+
| ノードタイプ | 説明 |
|
|
123
|
+
|------------|------|
|
|
124
|
+
| **Webhook** | LINE プラットフォームからのwebhookを受信 |
|
|
125
|
+
| **Reply Message** | リプライトークンを使用して返信メッセージを送信 |
|
|
126
|
+
| **Push Message** | 特定のユーザーにプッシュメッセージを送信 |
|
|
127
|
+
| **Broadcast Message** | Bot友達全員にメッセージを送信 |
|
|
128
|
+
| **Loading** | ローディングインジケーターを表示 |
|
|
129
|
+
| **Get Profile** | ユーザープロフィール情報を取得 |
|
|
130
|
+
| **Get Bot Info** | Bot情報を取得 |
|
|
131
|
+
| **Limit** | メッセージクォータ制限を確認 |
|
|
132
|
+
| **LINE Bot Config** | Bot認証情報を保存(バックグラウンドノード) |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 動作環境と要件
|
|
137
|
+
|
|
138
|
+
- **HTTPS必須**: 本番環境のwebhookエンドポイントには必要
|
|
139
|
+
- **LINE Developersアカウント**: LINE Bot作成に必要
|
|
140
|
+
- **Node-RED**: Node-RED v1.0+に対応
|
|
141
|
+
- **依存関係**: @line/bot-sdk, express, body-parser, cors
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## リンク
|
|
146
|
+
|
|
147
|
+
* [Node-RED Flows](https://flows.nodered.org/node/node-red-contrib-line-messaging-api)
|
|
148
|
+
* [Libraries.io](https://libraries.io/npm/node-red-contrib-line-messaging-api)
|
|
149
|
+
* [npm](https://www.npmjs.com/package/node-red-contrib-line-messaging-api)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## リリースノート
|
|
154
|
+
|
|
155
|
+
- 2024/12/27: Loading / getProfile / configノードの追加
|
|
156
|
+
- 2023/12/11: Notify_newを追加。スタンプや画像も送れるように。
|
|
157
|
+
- 2021/8/1: Reply Messageが画像に対応(thanks [@ukkz](https://github.com/ukkz))
|
|
158
|
+
- 2020/12/17: Bloadcast Messageに対応、Reply MessageがFlex Messageに対応(thanks [@gaomar](https://github.com/gaomar))
|
|
159
|
+
- 2019/2/13: PUSH MessageとLINE Notify対応
|
|
160
|
+
- 2018/10/11: 基本的なリプライ機能で初回リリース
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## コントリビューション・ライセンス
|
|
165
|
+
|
|
166
|
+
プルリクエストやバグレポートを歓迎します。
|
|
167
|
+
このプロジェクトは[Apache 2.0 ライセンス](https://www.apache.org/licenses/LICENSE-2.0)の下で提供されています。
|
|
168
|
+
|
|
169
|
+
作成者・メンテナー: [n0bisuke](https://github.com/n0bisuke)
|
|
170
|
+
|
|
171
|
+
---
|
package/README.md
CHANGED
|
@@ -1,47 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
# node-red-contrib-line-messaging-api
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[日本語版はこちら (Japanese version)](README.ja.md)
|
|
4
4
|
|
|
5
|
-
LINE
|
|
5
|
+
[Node-RED](http://nodered.org) nodes for LINE Messaging API integration.
|
|
6
|
+
Build LINE Bots easily with Node-RED's visual programming interface.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
---
|
|
8
9
|
|
|
10
|
+
## About this project
|
|
11
|
+
|
|
12
|
+
This package provides Node-RED nodes for integrating with LINE Messaging API, allowing you to create LINE Bots using Node-RED's visual flow editor. Create webhooks, send messages, and handle LINE Bot events with simple drag-and-drop nodes.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Run the following command in the root directory of your Node-RED install:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install node-red-contrib-line-messaging-api
|
|
9
22
|
```
|
|
10
|
-
npm i node-red-contrib-line-messaging-api
|
|
11
|
-
```
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
Or using Node-RED's Palette Manager:
|
|
25
|
+
|
|
26
|
+
1. Go to the Node-RED menu
|
|
27
|
+
2. Select "Manage palette"
|
|
28
|
+
3. Click the "Install" tab
|
|
29
|
+
4. Search for "line-messaging-api"
|
|
30
|
+
5. Click install
|
|
14
31
|
|
|
15
|
-
|
|
32
|
+
---
|
|
16
33
|
|
|
17
|
-
##
|
|
34
|
+
## Configuration
|
|
18
35
|
|
|
19
|
-
LINE Bot
|
|
20
|
-
|
|
36
|
+
### LINE Bot Config Node
|
|
37
|
+
|
|
38
|
+
The configuration node stores your LINE Bot credentials (Channel Secret and Channel Access Token). This background node isn't displayed in the editor but is accessible through the settings UI of Reply and Push nodes.
|
|
21
39
|
|
|
22
40
|
> 
|
|
23
41
|
|
|
24
|
-
|
|
42
|
+
Created LINE Bot configurations can be shared across multiple Reply and Push nodes.
|
|
43
|
+
|
|
44
|
+
---
|
|
25
45
|
|
|
26
|
-
##
|
|
46
|
+
## Available APIs and Usage
|
|
27
47
|
|
|
28
48
|
### Webhook & Reply Message
|
|
29
49
|
|
|
30
|
-
1. Webhook
|
|
31
|
-
2. ReplyMessage
|
|
32
|
-
3. Webhook
|
|
33
|
-
|
|
34
|
-
4.
|
|
50
|
+
1. Place a Webhook node and double-click to configure it. Set the `/path` and register the Webhook URL (your hostname + path) in the LINE Developers console for your Messaging API.
|
|
51
|
+
2. Place a ReplyMessage node and configure the channel secret and access token.
|
|
52
|
+
3. Connect the Webhook node to the ReplyMessage node to create an echo bot that responds to LINE messages.
|
|
53
|
+
[](https://gyazo.com/7da2dbecfc69515edf852cf7a26d9196)
|
|
54
|
+
4. Process `msg.payload` between the Webhook and ReplyMessage nodes to send various message types. Use plain text strings for text messages, or [LINE-defined message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects) for rich messages.
|
|
35
55
|
|
|
36
56
|
### Push Message
|
|
37
57
|
|
|
38
|
-
|
|
58
|
+
Send push messages by setting text in `msg.payload` to send text messages.
|
|
39
59
|
|
|
40
60
|
> 
|
|
41
61
|
|
|
42
|
-
####
|
|
62
|
+
#### Text Message v2 with User Mentions
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
Send push messages with user mentions using Text Message v2 by setting `msg.payload` with `{placeholder}` text and configuring `msg.substitution`.
|
|
45
65
|
|
|
46
66
|
- msg.payload: `Welcome, {user1}! {laugh}\n{everyone} There is a newcomer!`
|
|
47
67
|
- msg.substitution:
|
|
@@ -52,9 +72,9 @@ Pushメッセージを送るときにmsg.payloadに`{hoge}`などのテキスト
|
|
|
52
72
|
|
|
53
73
|
> 
|
|
54
74
|
|
|
55
|
-
####
|
|
75
|
+
#### Custom Messages
|
|
56
76
|
|
|
57
|
-
|
|
77
|
+
Send custom messages by setting arrays or [message objects](https://developers.line.biz/en/reference/messaging-api/#message-objects) in `msg.payload`.
|
|
58
78
|
|
|
59
79
|
```js
|
|
60
80
|
msg.payload = [
|
|
@@ -72,67 +92,80 @@ msg.payload = [
|
|
|
72
92
|
return msg;
|
|
73
93
|
```
|
|
74
94
|
|
|
75
|
-
###
|
|
95
|
+
### Broadcast Message
|
|
76
96
|
|
|
77
|
-
|
|
97
|
+
Send messages to all bot friends.
|
|
78
98
|
|
|
79
99
|
> 
|
|
80
100
|
|
|
81
101
|
### Loading
|
|
82
102
|
|
|
83
|
-
|
|
103
|
+
Display loading indicators to users.
|
|
84
104
|
|
|
85
105
|
> 
|
|
86
|
-
> https://developers.line.biz/
|
|
106
|
+
> https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator
|
|
87
107
|
|
|
88
|
-
###
|
|
108
|
+
### Get Profile
|
|
89
109
|
|
|
90
|
-
|
|
91
|
-
https://developers.line.biz/
|
|
110
|
+
Retrieve user profile information.
|
|
111
|
+
https://developers.line.biz/en/reference/messaging-api/#get-profile
|
|
92
112
|
|
|
93
|
-
###
|
|
113
|
+
### Get Bot Info
|
|
94
114
|
|
|
95
|
-
|
|
115
|
+
Retrieve bot information.
|
|
116
|
+
https://developers.line.biz/en/reference/messaging-api/#get-bot-info
|
|
96
117
|
|
|
97
|
-
|
|
118
|
+
---
|
|
98
119
|
|
|
99
|
-
|
|
120
|
+
## Node Types
|
|
100
121
|
|
|
101
|
-
|
|
122
|
+
| Node Type | Description |
|
|
123
|
+
|-----------|-------------|
|
|
124
|
+
| **Webhook** | Receives webhooks from LINE platform |
|
|
125
|
+
| **Reply Message** | Sends reply messages using reply tokens |
|
|
126
|
+
| **Push Message** | Sends push messages to specific users |
|
|
127
|
+
| **Broadcast Message** | Sends messages to all bot friends |
|
|
128
|
+
| **Loading** | Displays loading indicators |
|
|
129
|
+
| **Get Profile** | Retrieves user profile information |
|
|
130
|
+
| **Get Bot Info** | Retrieves bot information |
|
|
131
|
+
| **Limit** | Checks message quota limits |
|
|
132
|
+
| **LINE Bot Config** | Stores bot credentials (background node) |
|
|
102
133
|
|
|
103
|
-
|
|
134
|
+
---
|
|
104
135
|
|
|
105
|
-
|
|
136
|
+
## Browser Compatibility and Requirements
|
|
106
137
|
|
|
107
|
-
|
|
138
|
+
- **HTTPS Required**: For production webhook endpoints
|
|
139
|
+
- **LINE Developers Account**: Required for creating LINE Bots
|
|
140
|
+
- **Node-RED**: Compatible with Node-RED v1.0+
|
|
141
|
+
- **Dependencies**: @line/bot-sdk, express, body-parser, cors
|
|
108
142
|
|
|
109
|
-
|
|
143
|
+
---
|
|
110
144
|
|
|
111
|
-
|
|
145
|
+
## Links
|
|
112
146
|
|
|
113
|
-
-
|
|
147
|
+
* [Node-RED Flows](https://flows.nodered.org/node/node-red-contrib-line-messaging-api)
|
|
148
|
+
* [Libraries.io](https://libraries.io/npm/node-red-contrib-line-messaging-api)
|
|
149
|
+
* [npm](https://www.npmjs.com/package/node-red-contrib-line-messaging-api)
|
|
114
150
|
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
"stickerPackageId": "446",
|
|
118
|
-
"stickerId": "1988",
|
|
119
|
-
"message": "{{payload}}",
|
|
120
|
-
"imageThumbnail": "https://i.gyazo.com/a84c585225af440bd0d5fff881152792.png",
|
|
121
|
-
"imageFullsize": "https://i.gyazo.com/a84c585225af440bd0d5fff881152792.png"
|
|
122
|
-
}
|
|
123
|
-
```
|
|
151
|
+
---
|
|
124
152
|
|
|
125
|
-
##
|
|
153
|
+
## Release Notes
|
|
126
154
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
155
|
+
- 2024/12/27: Added Loading, getProfile, and config nodes
|
|
156
|
+
- 2023/12/11: Added Notify_new with sticker and image support
|
|
157
|
+
- 2021/8/1: Reply Message now supports images (thanks [@ukkz](https://github.com/ukkz))
|
|
158
|
+
- 2020/12/17: Added Broadcast Message support, Reply Message supports Flex Messages (thanks [@gaomar](https://github.com/gaomar))
|
|
159
|
+
- 2019/2/13: Added PUSH Message and LINE Notify support
|
|
160
|
+
- 2018/10/11: Initial release with basic reply functionality
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Contributing & License
|
|
165
|
+
|
|
166
|
+
Pull requests and bug reports are welcome.
|
|
167
|
+
This project is licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
|
|
130
168
|
|
|
131
|
-
|
|
169
|
+
Created and maintained by [n0bisuke](https://github.com/n0bisuke).
|
|
132
170
|
|
|
133
|
-
|
|
134
|
-
- 2023/12/11: Notify_newを追加。スタンプや画像も送れるように。
|
|
135
|
-
- 2021/8/1: Reply Messageが画像に対応(thanks [@ukkz](https://github.com/ukkz))
|
|
136
|
-
- 2020/12/17: Bloadcast Messageに対応、Reply MessageがFlex Messageに対応(thanks [@gaomar](https://github.com/gaomar))
|
|
137
|
-
- 2019/2/13: PUSH MessageとLINE Notify対応
|
|
138
|
-
- 2018/10/11: 現状は簡単なリプライのみ実装されています。
|
|
171
|
+
---
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
<script type="text/html" data-template-name="ReplyMessage_New">
|
|
26
26
|
<div class="form-row">
|
|
27
|
-
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
27
|
+
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="common.label.name">Name</span></label>
|
|
28
28
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
29
29
|
</div>
|
|
30
30
|
|
|
@@ -32,23 +32,22 @@
|
|
|
32
32
|
<div class="form-row">
|
|
33
33
|
<label for="node-input-lineConfig">
|
|
34
34
|
<i class="fa fa-tag"></i>
|
|
35
|
-
LINE Bot
|
|
36
|
-
|
|
37
|
-
</label> <input type="text" id="node-input-lineConfig" data-i18n="[placeholder]getProfile.desc.lineConfig">
|
|
35
|
+
<span data-i18n="common.label.bot">LINE Bot</span>
|
|
36
|
+
</label> <input type="text" id="node-input-lineConfig">
|
|
38
37
|
</div>
|
|
39
38
|
|
|
40
39
|
<div class="form-row">
|
|
41
|
-
<label for="node-input-channelSecret"><i class="icon-tag"></i> Secret</label>
|
|
40
|
+
<label for="node-input-channelSecret"><i class="icon-tag"></i> <span data-i18n="lineConfig.label.channelSecret">Secret</span></label>
|
|
42
41
|
<input type="password" id="node-input-channelSecret" placeholder="ChannelSecret">
|
|
43
42
|
</div>
|
|
44
43
|
|
|
45
44
|
<div class="form-row">
|
|
46
|
-
<label for="node-input-channelAccessToken"><i class="icon-tag"></i> AccessToken</label>
|
|
45
|
+
<label for="node-input-channelAccessToken"><i class="icon-tag"></i> <span data-i18n="lineConfig.label.channelAccessToken">AccessToken</span></label>
|
|
47
46
|
<input type="password" id="node-input-channelAccessToken" placeholder="ChannelAccessToken">
|
|
48
47
|
</div>
|
|
49
48
|
|
|
50
49
|
<div class="form-row">
|
|
51
|
-
<label for="node-input-replyMessage"><i class="icon-tag"></i> ReplyMessage</label>
|
|
50
|
+
<label for="node-input-replyMessage"><i class="icon-tag"></i> <span data-i18n="reply.label.message">ReplyMessage</span></label>
|
|
52
51
|
<input type="text" id="node-input-replyMessage" placeholder="static text message here">
|
|
53
52
|
</div>
|
|
54
53
|
</script>
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
<script type="text/x-red" data-template-name="BloadcastMessage">
|
|
26
26
|
|
|
27
27
|
<div class="form-row">
|
|
28
|
-
<label for="node-input-name"><i class="icon-tag"></i>
|
|
28
|
+
<label for="node-input-name"><i class="icon-tag"></i> <span data-i18n="bloadcast.label.name">名前</span></label>
|
|
29
29
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
32
|
<div class="form-row">
|
|
33
|
-
<label for="node-input-channelSecret"><i class="icon-tag"></i>
|
|
33
|
+
<label for="node-input-channelSecret"><i class="icon-tag"></i> <span data-i18n="bloadcast.label.channelSecret">チャンネルシークレット</span></label>
|
|
34
34
|
<input type="password" id="node-input-channelSecret" placeholder="ChannelSecret">
|
|
35
35
|
</div>
|
|
36
36
|
|
|
37
37
|
<div class="form-row">
|
|
38
|
-
<label for="node-input-channelAccessToken"><i class="icon-tag"></i>
|
|
38
|
+
<label for="node-input-channelAccessToken"><i class="icon-tag"></i> <span data-i18n="bloadcast.label.channelAccessToken">チャンネルアクセストークン</span></label>
|
|
39
39
|
<input type="password" id="node-input-channelAccessToken" placeholder="ChannelAccessToken">
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<script type="text/x-red" data-help-name="BloadcastMessage">
|
|
45
|
-
<p>
|
|
45
|
+
<p>Broadcasts messages to all LINE Bot friends.</p>
|
|
46
46
|
</script>
|
package/nodes/config/config.html
CHANGED
|
@@ -27,13 +27,21 @@
|
|
|
27
27
|
|
|
28
28
|
// 1. Bot Name のチェック
|
|
29
29
|
if ($("#node-config-input-botName").val() === "") {
|
|
30
|
-
|
|
30
|
+
let message = node._("lineConfig.validation.botNameRequired");
|
|
31
|
+
if (!message || message === "lineConfig.validation.botNameRequired") {
|
|
32
|
+
message = "Bot名は必須です。";
|
|
33
|
+
}
|
|
34
|
+
errorMessages.push("・" + message);
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
// 2. Channel Secret のチェック
|
|
34
38
|
const secret = $("#node-config-input-LineChannelSecret").val();
|
|
35
39
|
if (secret === "") {
|
|
36
|
-
|
|
40
|
+
let message = node._("lineConfig.validation.channelSecretRequired");
|
|
41
|
+
if (!message || message === "lineConfig.validation.channelSecretRequired") {
|
|
42
|
+
message = "Channel Secret は必須です。";
|
|
43
|
+
}
|
|
44
|
+
errorMessages.push("・" + message);
|
|
37
45
|
} else if (hasWhitespace.test(secret)) {
|
|
38
46
|
errorMessages.push("・Channel Secret にスペースや改行は含められません。");
|
|
39
47
|
} else if (hasFullWidth.test(secret)) {
|
|
@@ -45,7 +53,11 @@
|
|
|
45
53
|
// 3. Channel Access Token のチェック
|
|
46
54
|
const token = $("#node-config-input-LineChannelAccessToken").val();
|
|
47
55
|
if (token === "") {
|
|
48
|
-
|
|
56
|
+
let message = node._("lineConfig.validation.channelAccessTokenRequired");
|
|
57
|
+
if (!message || message === "lineConfig.validation.channelAccessTokenRequired") {
|
|
58
|
+
message = "Channel Access Token は必須です。";
|
|
59
|
+
}
|
|
60
|
+
errorMessages.push("・" + message);
|
|
49
61
|
} else if (hasWhitespace.test(token)) {
|
|
50
62
|
errorMessages.push("・Channel Access Token にスペースや改行は含められません。");
|
|
51
63
|
} else if (hasFullWidth.test(token)) {
|
|
@@ -82,7 +94,7 @@
|
|
|
82
94
|
const channelAccessToken = $("#node-config-input-LineChannelAccessToken").val();
|
|
83
95
|
|
|
84
96
|
if (!channelSecret || !channelAccessToken) {
|
|
85
|
-
RED.notify("
|
|
97
|
+
RED.notify(node._("message.fetchingBotInfo"), "warning");
|
|
86
98
|
return;
|
|
87
99
|
}
|
|
88
100
|
|
|
@@ -96,7 +108,7 @@
|
|
|
96
108
|
|
|
97
109
|
if (!response.ok) {
|
|
98
110
|
const errorText = await response.text();
|
|
99
|
-
throw new Error("API
|
|
111
|
+
throw new Error("API Error: " + errorText);
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
const botInfo = await response.json();
|
|
@@ -114,9 +126,9 @@
|
|
|
114
126
|
$("#node-config-input-botIconUrl").val("");
|
|
115
127
|
$("#node-config-botIcon").hide();
|
|
116
128
|
}
|
|
117
|
-
RED.notify("
|
|
129
|
+
RED.notify(node._("message.fetchSuccess"), "success");
|
|
118
130
|
} catch (err) {
|
|
119
|
-
RED.notify("
|
|
131
|
+
RED.notify(node._("message.fetchError") + ": " + err.message, "error");
|
|
120
132
|
}
|
|
121
133
|
// ★★★ ここまでが復元部分です ★★★
|
|
122
134
|
});
|
|
@@ -143,24 +155,24 @@
|
|
|
143
155
|
|
|
144
156
|
<div class="form-row">
|
|
145
157
|
<label for="node-config-input-botName">
|
|
146
|
-
<i class="fa fa-tag fa-fw"></i> Bot
|
|
158
|
+
<i class="fa fa-tag fa-fw"></i> <span data-i18n="label.botName">Bot名</span>
|
|
147
159
|
</label>
|
|
148
160
|
<input type="text" id="node-config-input-botName" placeholder="BOT Name">
|
|
149
161
|
</div>
|
|
150
162
|
|
|
151
163
|
<div class="form-row">
|
|
152
|
-
<label for="node-config-input-LineChannelSecret">Channel Secret</label>
|
|
164
|
+
<label for="node-config-input-LineChannelSecret"><span data-i18n="label.channelSecret">Channel Secret</span></label>
|
|
153
165
|
<input type="text" id="node-config-input-LineChannelSecret" placeholder="LINE Channel Secret">
|
|
154
166
|
</div>
|
|
155
167
|
|
|
156
168
|
<div class="form-row">
|
|
157
|
-
<label for="node-config-input-LineChannelAccessToken">Channel Access Token</label>
|
|
169
|
+
<label for="node-config-input-LineChannelAccessToken"><span data-i18n="label.channelAccessToken">Channel Access Token</span></label>
|
|
158
170
|
<input type="text" id="node-config-input-LineChannelAccessToken" placeholder="LINE Channel Access Token">
|
|
159
171
|
</div>
|
|
160
172
|
|
|
161
173
|
<!-- Bot Icon 表示エリア -->
|
|
162
174
|
<div class="form-row">
|
|
163
|
-
<label>Bot Icon</label><br/>
|
|
175
|
+
<label><span data-i18n="label.botIcon">Bot Icon</span></label><br/>
|
|
164
176
|
<img id="node-config-botIcon" src=""
|
|
165
177
|
style="display:none; max-width: 100px; border-radius: 10%;" />
|
|
166
178
|
</div>
|
|
@@ -173,7 +185,7 @@
|
|
|
173
185
|
</div>
|
|
174
186
|
|
|
175
187
|
<div class="form-row">
|
|
176
|
-
<button type="button" id="node-config-fetch-info">Bot名&アイコンを取得</button>
|
|
188
|
+
<button type="button" id="node-config-fetch-info"><span data-i18n="label.fetchBotInfo">Bot名&アイコンを取得</span></button>
|
|
177
189
|
</div>
|
|
178
190
|
</div>
|
|
179
191
|
|
|
@@ -185,4 +197,4 @@
|
|
|
185
197
|
color: white;
|
|
186
198
|
}
|
|
187
199
|
</style>
|
|
188
|
-
</script>
|
|
200
|
+
</script>
|
package/nodes/config/config.js
CHANGED
|
@@ -22,7 +22,7 @@ module.exports = function(RED) {
|
|
|
22
22
|
const channelSecret = req.body.channelSecret;
|
|
23
23
|
const channelAccessToken = req.body.channelAccessToken;
|
|
24
24
|
if (!channelSecret || !channelAccessToken) {
|
|
25
|
-
return res.status(400).send("No channelSecret or channelAccessToken");
|
|
25
|
+
return res.status(400).send(RED._("validation.channelSecretRequired") || "No channelSecret or channelAccessToken");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const clientConfig = {
|
|
@@ -37,7 +37,7 @@ module.exports = function(RED) {
|
|
|
37
37
|
|
|
38
38
|
} catch (err) {
|
|
39
39
|
console.error("Failed to getBotInfo:", err);
|
|
40
|
-
res.status(500).send(err.message || "Failed to get botInfo");
|
|
40
|
+
res.status(500).send(err.message || RED._("message.fetchError") || "Failed to get botInfo");
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -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>
|
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>
|
|
@@ -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.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
|
-
}
|