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.
Files changed (38) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/CLAUDE.md +23 -1
  3. package/README.ja.md +172 -0
  4. package/README.md +95 -61
  5. package/nodes/_new/reply/reply.html +6 -7
  6. package/nodes/_new/reply/reply.js +1 -1
  7. package/nodes/bloadcast/bloadcast.html +4 -4
  8. package/nodes/bloadcast/locales/ja/bloadcast.json +9 -0
  9. package/nodes/config/config.html +25 -13
  10. package/nodes/config/config.js +2 -2
  11. package/nodes/config/locales/en-US/config.json +14 -0
  12. package/nodes/config/locales/ja/config.json +14 -0
  13. package/nodes/getBotInfo/getBotInfo.html +11 -8
  14. package/nodes/getBotInfo/locales/en-US/getBotInfo.json +9 -0
  15. package/nodes/getBotInfo/locales/ja/getBotInfo.json +9 -0
  16. package/nodes/getProfile/getProfile.html +6 -6
  17. package/nodes/getProfile/locales/en-US/getProfile.json +8 -0
  18. package/nodes/getProfile/locales/ja/getProfile.json +8 -0
  19. package/nodes/limit/limit.html +3 -3
  20. package/nodes/limit/locales/ja/limit.json +8 -0
  21. package/nodes/loading/loading.html +7 -10
  22. package/nodes/loading/locales/ja/loading.json +10 -0
  23. package/nodes/markAsRead/locales/ja/markAsRead.json +8 -0
  24. package/nodes/markAsRead/markAsRead.html +44 -0
  25. package/nodes/markAsRead/markAsRead.js +57 -0
  26. package/nodes/push/locales/ja/push.json +10 -0
  27. package/nodes/push/push.html +4 -5
  28. package/nodes/reply/locales/ja/reply.json +7 -0
  29. package/nodes/reply/reply.html +5 -5
  30. package/nodes/reply/reply.js +10 -4
  31. package/nodes/webhook/locales/en-US/Webhook.json +8 -0
  32. package/nodes/webhook/locales/ja/Webhook.json +8 -0
  33. package/nodes/webhook/webhook.html +2 -2
  34. package/package.json +13 -9
  35. package/nodes/_new/notify/notify.html +0 -39
  36. package/nodes/_new/notify/notify.js +0 -57
  37. package/nodes/notify/notify.html +0 -42
  38. package/nodes/notify/notify.js +0 -38
@@ -0,0 +1,12 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(mkdir:*)",
5
+ "Bash(mv:*)",
6
+ "Bash(grep:*)",
7
+ "Bash(find:*)",
8
+ "Bash(rm:*)"
9
+ ],
10
+ "deny": []
11
+ }
12
+ }
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,172 @@
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
+ > ![](https://i.gyazo.com/1443049286c39432bcf08647dcbff893.gif)
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
+ [![Image from Gyazo](https://i.gyazo.com/7da2dbecfc69515edf852cf7a26d9196.gif)](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
+ > ![](https://i.gyazo.com/1562a3e4539469515c798d9e3c50d052.gif)
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
+ > ![](https://i.gyazo.com/3fa696275f53251bf99e7a1354183d72.png)
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
+ > ![](https://i.gyazo.com/ef7c655a74e85e23db5ee156e5490e15.png)
100
+
101
+ ### Loading
102
+
103
+ ローディングアニメーションを表示させます。
104
+
105
+ > ![](https://i.gyazo.com/355a5f5cca896740eaa50a7b9d76a8fc.gif)
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: v0.4.3 - 多言語化(i18n)対応、LINE Notifyノード削除(API終了)、英語・日本語ドキュメント整備
156
+ - 2024/12/27: Loading / getProfile / configノードの追加
157
+ - 2023/12/11: Notify_newを追加。スタンプや画像も送れるように。
158
+ - 2021/8/1: Reply Messageが画像に対応(thanks [@ukkz](https://github.com/ukkz))
159
+ - 2020/12/17: Bloadcast Messageに対応、Reply MessageがFlex Messageに対応(thanks [@gaomar](https://github.com/gaomar))
160
+ - 2019/2/13: PUSH MessageとLINE Notify対応
161
+ - 2018/10/11: 基本的なリプライ機能で初回リリース
162
+
163
+ ---
164
+
165
+ ## コントリビューション・ライセンス
166
+
167
+ プルリクエストやバグレポートを歓迎します。
168
+ このプロジェクトは[Apache 2.0 ライセンス](https://www.apache.org/licenses/LICENSE-2.0)の下で提供されています。
169
+
170
+ 作成者・メンテナー: [n0bisuke](https://github.com/n0bisuke)
171
+
172
+ ---
package/README.md CHANGED
@@ -1,47 +1,67 @@
1
- LINE Messagin APIのNode-REDのノードです。
1
+ # node-red-contrib-line-messaging-api
2
2
 
3
- ## 概要
3
+ [日本語版はこちら (Japanese version)](README.ja.md)
4
4
 
5
- LINE Messagin APIを利用できるNode-REDのノードです。
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
- or
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
- AdminタブからInstall
32
+ ---
16
33
 
17
- ## Configノード
34
+ ## Configuration
18
35
 
19
- LINE Botの設定(チャンネルシークレット、チャンネルアクセストークン)を設定しておく裏側のノードです。
20
- このノードはエディターには表示されずReplyやPushなどのノードの設定UIからアクセスできます。
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
  > ![](https://i.gyazo.com/1443049286c39432bcf08647dcbff893.gif)
23
41
 
24
- 作成したLINE Botの設定は別のReplyノードやPushノードで使いまわせます。
42
+ Created LINE Bot configurations can be shared across multiple Reply and Push nodes.
43
+
44
+ ---
25
45
 
26
- ## 利用できるAPIと利用イメージ
46
+ ## Available APIs and Usage
27
47
 
28
48
  ### Webhook & Reply Message
29
49
 
30
- 1. Webhookノードを配置し、ダブルクリックで設定を開き、指定した `/path` と自身のホスト名の組み合わせ(Webhook URL)を、LINE Developersであらかじめ作成したMessaging APIに登録します。
31
- 2. ReplyMessageノードを配置し、チャネルのシークレットとアクセストークンを設定します。
32
- 3. WebhookノードとReplyMessageノードを接続してLINEにメッセージを送るとオウム返しBotができます。
33
- [![Image from Gyazo](https://i.gyazo.com/7da2dbecfc69515edf852cf7a26d9196.gif)](https://gyazo.com/7da2dbecfc69515edf852cf7a26d9196)
34
- 4. WebhookノードとReplyMessageノードの中間で `msg.payload` をうまく作成すると様々なメッセージが送れます。文字列を指定すると通常のテキストメッセージに、[LINEで定義されているメッセージオブジェクト](https://developers.line.biz/ja/reference/messaging-api/#message-objects)を指定すればそのメッセージを返信することができます。
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
+ [![Image from Gyazo](https://i.gyazo.com/7da2dbecfc69515edf852cf7a26d9196.gif)](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
- Pushメッセージを送るときにmsg.payloadにテキストを入れることでテキストメッセージの送信ができます。
58
+ Send push messages by setting text in `msg.payload` to send text messages.
39
59
 
40
60
  > ![](https://i.gyazo.com/1562a3e4539469515c798d9e3c50d052.gif)
41
61
 
42
- #### テキストメッセージv2でユーザーにメンション
62
+ #### Text Message v2 with User Mentions
43
63
 
44
- Pushメッセージを送るときにmsg.payloadに`{hoge}`などのテキストを入れつつ、msg.substitutionを設定することでテキストメッセージv2を使ってユーザーにメンションすることができます。
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
  > ![](https://i.gyazo.com/3fa696275f53251bf99e7a1354183d72.png)
54
74
 
55
- #### 任意のメッセージ
75
+ #### Custom Messages
56
76
 
57
- msg.payloadに配列や[メッセージオブジェクト](https://developers.line.biz/ja/reference/messaging-api/#message-objects)を設定することで任意のメッセージを送信できます。
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,81 @@ msg.payload = [
72
92
  return msg;
73
93
  ```
74
94
 
75
- ### Bloadcast Message
95
+ ### Broadcast Message
76
96
 
77
- * 友達全員にメッセージ配信
97
+ Send messages to all bot friends.
78
98
 
79
99
  > ![](https://i.gyazo.com/ef7c655a74e85e23db5ee156e5490e15.png)
80
100
 
81
101
  ### Loading
82
102
 
83
- ローディングを表示させます。
103
+ Display loading indicators to users.
84
104
 
85
105
  > ![](https://i.gyazo.com/355a5f5cca896740eaa50a7b9d76a8fc.gif)
86
- > https://developers.line.biz/ja/reference/messaging-api/#display-a-loading-indicator
106
+ > https://developers.line.biz/en/reference/messaging-api/#display-a-loading-indicator
87
107
 
88
- ### getProfile
108
+ ### Get Profile
89
109
 
90
- ユーザーの情報を取得します。
91
- https://developers.line.biz/ja/reference/messaging-api/#get-profile
110
+ Retrieve user profile information.
111
+ https://developers.line.biz/en/reference/messaging-api/#get-profile
92
112
 
93
- ### getBotInfo
113
+ ### Get Bot Info
94
114
 
95
- BOTの情報を取得します。
115
+ Retrieve bot information.
116
+ https://developers.line.biz/en/reference/messaging-api/#get-bot-info
96
117
 
97
- https://developers.line.biz/ja/reference/messaging-api/#get-bot-info
118
+ ---
98
119
 
99
- ### LINE Notify (2024/12/22追記: API自体が終了するため廃止予定です。)
120
+ ## Node Types
100
121
 
101
- > ![](https://i.gyazo.com/e64db6a7ee48cea43ed3c70b5fd2f05f.gif)
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
- ### LINE Notify_new
134
+ ---
104
135
 
105
- 過去のものとAPIは変わってないですが、オプション指定ができます。
136
+ ## Browser Compatibility and Requirements
106
137
 
107
- > ![](https://i.gyazo.com/b9d963d9357e26c86d4d771b16726195.png)
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
- template nodeにJSONを設定してみてください。
143
+ ---
110
144
 
111
- > ![](https://i.gyazo.com/d4f040678957fffbfb6b074966051aa1.png)
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
- ## LINK
153
+ ## Release Notes
126
154
 
127
- * [NodeRED](https://flows.nodered.org/node/node-red-contrib-line-messaging-api)
128
- * [Libraries.io](https://libraries.io/npm/node-red-contrib-line-messaging-api)
129
- * [npm](https://www.npmjs.com/package/node-red-contrib-line-messaging-api)
155
+ - 2024/12/27: v0.4.3 - Added internationalization (i18n) support, removed LINE Notify nodes (API discontinued), updated documentation with English/Japanese versions
156
+ - 2024/12/27: Added Loading, getProfile, and config nodes
157
+ - 2023/12/11: Added Notify_new with sticker and image support
158
+ - 2021/8/1: Reply Message now supports images (thanks [@ukkz](https://github.com/ukkz))
159
+ - 2020/12/17: Added Broadcast Message support, Reply Message supports Flex Messages (thanks [@gaomar](https://github.com/gaomar))
160
+ - 2019/2/13: Added PUSH Message and LINE Notify support
161
+ - 2018/10/11: Initial release with basic reply functionality
162
+
163
+ ---
164
+
165
+ ## Contributing & License
166
+
167
+ Pull requests and bug reports are welcome.
168
+ This project is licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0).
130
169
 
131
- ## release
170
+ Created and maintained by [n0bisuke](https://github.com/n0bisuke).
132
171
 
133
- - 2024/12/27: Loaging / getProfile / configの追加
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: 現状は簡単なリプライのみ実装されています。
172
+ ---
@@ -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
- <span data-i18n="getProfile.label.lineConfig"></span>
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>
@@ -64,7 +64,7 @@ module.exports = (RED) => {
64
64
 
65
65
  // 新仕様
66
66
  const reply = async (msg) => {
67
- console.log(typeof msg.payload, msg.payload);
67
+ // console.log(typeof msg.payload, msg.payload);
68
68
  if (!msg.line || !msg.line.event || !msg.line.event.type) {
69
69
  throw 'no valid LINE event found within msg';
70
70
  } else if (!msg.line.event.replyToken) {
@@ -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> Name</label>
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> Secret</label>
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> AccessToken</label>
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>Send a push message to all your BOT friends.</p>
45
+ <p>Broadcasts messages to all LINE Bot friends.</p>
46
46
  </script>
@@ -0,0 +1,9 @@
1
+ {
2
+ "bloadcast": {
3
+ "label": {
4
+ "name": "名前",
5
+ "channelSecret": "チャンネルシークレット",
6
+ "channelAccessToken": "チャンネルアクセストークン"
7
+ }
8
+ }
9
+ }
@@ -27,13 +27,21 @@
27
27
 
28
28
  // 1. Bot Name のチェック
29
29
  if ($("#node-config-input-botName").val() === "") {
30
- errorMessages.push("・Bot Name は必須です。");
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
- errorMessages.push("・Channel Secret は必須です。");
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
- errorMessages.push("・Channel Access Token は必須です。");
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("Channel Secret と Access Token を両方入力してから取得してください。", "warning");
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エラー: " + errorText);
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("Botの情報を取得しました。", "success");
129
+ RED.notify(node._("message.fetchSuccess"), "success");
118
130
  } catch (err) {
119
- RED.notify("Bot情報を取得できませんでした: " + err.message, "error");
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 Name
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>
@@ -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
  }