{"id":26499741,"url":"https://github.com/n0bisuke/node-red-contrib-line-messaging-api","last_synced_at":"2025-03-20T15:19:00.353Z","repository":{"id":33081513,"uuid":"151261814","full_name":"n0bisuke/node-red-contrib-line-messaging-api","owner":"n0bisuke","description":"NodeREDやenebularでLINE Messaging APIが利用できます。","archived":false,"fork":false,"pushed_at":"2024-12-29T14:37:08.000Z","size":79,"stargazers_count":7,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-04T17:50:17.171Z","etag":null,"topics":["enebular","javascript","nodejs","nodered"],"latest_commit_sha":null,"homepage":"https://flows.nodered.org/node/node-red-contrib-line-messaging-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n0bisuke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-02T13:47:28.000Z","updated_at":"2024-12-29T14:36:47.000Z","dependencies_parsed_at":"2022-07-08T07:31:50.970Z","dependency_job_id":null,"html_url":"https://github.com/n0bisuke/node-red-contrib-line-messaging-api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0bisuke%2Fnode-red-contrib-line-messaging-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0bisuke%2Fnode-red-contrib-line-messaging-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0bisuke%2Fnode-red-contrib-line-messaging-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n0bisuke%2Fnode-red-contrib-line-messaging-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n0bisuke","download_url":"https://codeload.github.com/n0bisuke/node-red-contrib-line-messaging-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244637101,"owners_count":20485446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["enebular","javascript","nodejs","nodered"],"created_at":"2025-03-20T15:18:59.635Z","updated_at":"2025-03-20T15:19:00.347Z","avatar_url":"https://github.com/n0bisuke.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"LINE Messagin APIのNode-REDのノードです。\n\n## 概要\n\nLINE Messagin APIを利用できるNode-REDのノードです。\n\n## インストール\n\n```\nnpm i node-red-contrib-line-messaging-api\n```\n\nor\n\nAdminタブからInstall\n\n## Configノード\n\nLINE Botの設定（チャンネルシークレット、チャンネルアクセストークン）を設定しておく裏側のノードです。\nこのノードはエディターには表示されずReplyやPushなどのノードの設定UIからアクセスできます。\n\n\u003e ![](https://i.gyazo.com/2528c7ebfae089dabef263b25f03112a.gif)\n\n作成したLINE Botの設定は別のReplyノードやPushノードで使いまわせます。\n\n## 利用できるAPIと利用イメージ\n\n### Webhook \u0026 Reply Message\n\n1. Webhookノードを配置し、ダブルクリックで設定を開き、指定した `/path` と自身のホスト名の組み合わせ（Webhook URL）を、LINE Developersであらかじめ作成したMessaging APIに登録します。\n2. ReplyMessageノードを配置し、チャネルのシークレットとアクセストークンを設定します。\n3. WebhookノードとReplyMessageノードを接続してLINEにメッセージを送るとオウム返しBotができます。  \n  [![Image from Gyazo](https://i.gyazo.com/7da2dbecfc69515edf852cf7a26d9196.gif)](https://gyazo.com/7da2dbecfc69515edf852cf7a26d9196)\n4. WebhookノードとReplyMessageノードの中間で `msg.payload` をうまく作成すると様々なメッセージが送れます。文字列を指定すると通常のテキストメッセージに、[LINEで定義されているメッセージオブジェクト](https://developers.line.biz/ja/reference/messaging-api/#message-objects)を指定すればそのメッセージを返信することができます。\n\n### Push Message\n\nPushメッセージを送るときにmsg.payloadにテキストを入れることでテキストメッセージの送信ができます。\n\n\u003e ![](https://i.gyazo.com/1562a3e4539469515c798d9e3c50d052.gif)\n\n#### テキストメッセージv2でユーザーにメンション\n\nPushメッセージを送るときにmsg.payloadに`{hoge}`などのテキストを入れつつ、msg.substitutionを設定することでテキストメッセージv2を使ってユーザーにメンションすることができます。\n\n- msg.payload: `Welcome, {user1}! {laugh}\\n{everyone} There is a newcomer!`\n- msg.substitution: \n\n```json\n{\"user1\": {\"type\": \"mention\", \"mentionee\": {\"type\": \"user\", \"userId\": \"Uxxxxxxxxxxxx\"}},\"laugh\": {\"type\": \"emoji\",\"productId\": \"670e0cce840a8236ddd4ee4c\",\"emojiId\": \"002\"},\"everyone\": {\"type\": \"mention\",\"mentionee\": {\"type\": \"all\"}}}\n```\n\n\u003e ![](https://i.gyazo.com/3fa696275f53251bf99e7a1354183d72.png)\n\n#### 任意のメッセージ\n\nmsg.payloadに配列や[メッセージオブジェクト](https://developers.line.biz/ja/reference/messaging-api/#message-objects)を設定することで任意のメッセージを送信できます。\n\n```js\nmsg.payload = [\n    {\n        type: \"text\",\n        text: \"hogehoge\",\n    },\n    {\n        type: \"image\",\n        originalContentUrl: 'https://i.gyazo.com/e772c3b48a07716226f7184d7f417cda.png',\n        previewImageUrl: 'https://i.gyazo.com/e772c3b48a07716226f7184d7f417cda.png'\n    }\n]\n\nreturn msg;\n```\n\n### Bloadcast Message\n\n* 友達全員にメッセージ配信\n\n\u003e ![](https://i.gyazo.com/ef7c655a74e85e23db5ee156e5490e15.png)\n\n### Loading\n\nローディングを表示させます。\n\n\u003e ![](https://i.gyazo.com/355a5f5cca896740eaa50a7b9d76a8fc.gif)\n\u003e https://developers.line.biz/ja/reference/messaging-api/#display-a-loading-indicator\n\n### LINE Notify （2024/12/22追記: API自体が終了するため廃止予定です。）\n\n\u003e ![](https://i.gyazo.com/e64db6a7ee48cea43ed3c70b5fd2f05f.gif)\n\n### LINE Notify_new\n\n過去のものとAPIは変わってないですが、オプション指定ができます。\n\n\u003e ![](https://i.gyazo.com/b9d963d9357e26c86d4d771b16726195.png)\n\ntemplate nodeにJSONを設定してみてください。\n\n\u003e ![](https://i.gyazo.com/d4f040678957fffbfb6b074966051aa1.png)\n\n- 画像とスタンプも送る例\n\n```\n{\n    \"stickerPackageId\": \"446\",\n    \"stickerId\": \"1988\",\n    \"message\": \"{{payload}}\",\n    \"imageThumbnail\": \"https://i.gyazo.com/a84c585225af440bd0d5fff881152792.png\",\n    \"imageFullsize\": \"https://i.gyazo.com/a84c585225af440bd0d5fff881152792.png\"\n}\n```\n\n## LINK\n\n* [NodeRED](https://flows.nodered.org/node/node-red-contrib-line-messaging-api)\n* [Libraries.io](https://libraries.io/npm/node-red-contrib-line-messaging-api)\n* [npm](https://www.npmjs.com/package/node-red-contrib-line-messaging-api)\n\n## release\n\n- 2024/12/27: Loaging / getProfile / configの追加\n- 2023/12/11: Notify_newを追加。スタンプや画像も送れるように。\n- 2021/8/1: Reply Messageが画像に対応（thanks [@ukkz](https://github.com/ukkz)）\n- 2020/12/17: Bloadcast Messageに対応、Reply MessageがFlex Messageに対応（thanks [@gaomar](https://github.com/gaomar)）\n- 2019/2/13: PUSH MessageとLINE Notify対応\n- 2018/10/11: 現状は簡単なリプライのみ実装されています。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn0bisuke%2Fnode-red-contrib-line-messaging-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn0bisuke%2Fnode-red-contrib-line-messaging-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn0bisuke%2Fnode-red-contrib-line-messaging-api/lists"}