{"id":22612410,"url":"https://github.com/miso-develop/linegrok","last_synced_at":"2025-04-11T09:16:21.998Z","repository":{"id":123961552,"uuid":"610864421","full_name":"miso-develop/linegrok","owner":"miso-develop","description":"Starting ngrok and acquiring URL, and updating the Webhook URL in the LINE Developers console at the same time.  ","archived":false,"fork":false,"pushed_at":"2024-05-11T11:31:54.000Z","size":89,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T15:01:57.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miso-develop.png","metadata":{"files":{"readme":"README.ja.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-07T16:26:32.000Z","updated_at":"2024-06-01T03:41:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"f28bf6c8-d76f-4887-a5b6-cad628279796","html_url":"https://github.com/miso-develop/linegrok","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"e07865bf959d0880321b7f6e27305bb2e62d5f71"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-develop%2Flinegrok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-develop%2Flinegrok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-develop%2Flinegrok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miso-develop%2Flinegrok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miso-develop","download_url":"https://codeload.github.com/miso-develop/linegrok/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248366378,"owners_count":21091955,"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":[],"created_at":"2024-12-08T17:12:46.826Z","updated_at":"2025-04-11T09:16:21.958Z","avatar_url":"https://github.com/miso-develop.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linegrok\n\n### [**English**](README.md) | **日本語**\n\nlinegrokはngrokの起動およびURL取得と、LINE DevelopersコンソールへのWebhook URL更新を同時に行います。  \n\n\n\n## インストール\n\n```sh\n$ npm install linegrok\n```\n\n\n\n## 使い方\n\nLINE BotのChannel Access Tokenと、Portを引数にわたして実行します。  \nあとは自動的にngrokプロセスが立ち上がり、発行されたngrok URLをBotのChannel Access Tokenに紐づくチャネルのWebhook URLに設定します。  \n\n```js\nconst { linegrok } = require(\"linegrok\")\n\nconst channelAccessToken = process.env.CHANNEL_ACCESS_TOKEN\nconst port = process.env.PORT\n\nlinegrok({ channelAccessToken, port })\n\n...\n\n```\n\n例としてオウム返しBotのコードは以下のようになります。  \n（環境変数にて`CHANNEL_ACCESS_TOKEN`、`CHANNEL_SECRET`を設定して実行してみてください）  \n\n```js\nconst express = require(\"express\")\nconst { messagingApi, middleware } = require(\"@line/bot-sdk\")\nconst { linegrok } = require(\"linegrok\")\n\nconst channelAccessToken = process.env.CHANNEL_ACCESS_TOKEN\nconst channelSecret = process.env.CHANNEL_SECRET\nconst port = process.env.PORT\n\nlinegrok({ channelAccessToken, port })\n\nconst client = new messagingApi.MessagingApiClient({ channelAccessToken })\n\n\n\nconst app = express()\napp.post(\"/\", middleware({ channelSecret }), (req, res) =\u003e {\n    handleEvents(req.body.events)\n    res.send({ status: 200 })\n})\napp.listen(port, () =\u003e console.log(`Start server!`))\n\n\n\nconst handleEvents = events =\u003e {\n    events.forEach(event =\u003e {\n        switch (event.type) {\n            case \"message\": client.replyMessage({\n                replyToken: event.replyToken,\n                messages: [{\n                    type: \"text\",\n                    text: event.message.text,\n                }]\n            }); break\n        }\n    })\n}\n```\n\n\n\n## オプション\n\n|オプション|必須|既定値|内容|\n|:--|:-:|:-:|:--|\n|channelAccessToken|✔|-|LINE BotのChannel Access Tokenを指定します。\u003cbr\u003eこのChannel Access Tokenに紐づくチャネルのWebhook URLが自動更新されます。|\n|port|✔|-|Botサーバーのポート番号を指定します。|\n|path||\"/\"|Webhook URLのpathを指定します。|\n|authtoken||undefined|ngrokのAuth Tokenを指定します。|\n|region||\"ja\"|ngrokのリージョンを指定します。|\n\n\n\n## ライセンス\n\n[**MIT**](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiso-develop%2Flinegrok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiso-develop%2Flinegrok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiso-develop%2Flinegrok/lists"}