1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LINE Messaging API で利用する groupId を無課金で取得する方法

Posted at

目的

Line Notifyが2025/年03月31日に終了するにあたり、Line Messaging APIに乗り換える必要がある。
Line Notifyのように単純にプッシュメッセージを送る方法は、公式が用意してくれているリファレンスを参照したらいい。

しかし、リクエストボディのtoに、userIdgroupId、またはroomIdの値を設定しなければいけないのだが、値を取得する方法がわからなかったので備忘録としてメモを残しておく。

具体的な方法

1. Webhook.siteでWebhook URLを発行する。

Webhook.site にアクセスすると、自動でURLが発行される。
Your unique URLの部分のURLをコピーしておく。

20250108_webhooksite.png

2. LINE Developers コンソールでWebhook URLを設定する。

  1. 1. の手順で発行したURLをLINE Developers コンソールのMessageing API設定Webhook設定Webhook URLに設定する。
    20250108_qiita_messaging-api-webhook.png
  2. Webhook URL設定後に正しく設定できたか確認を行う。
    LINE Developers コンソール側でWebhook URL検証ボタンを押下し、成功とポップアップが出ることを確認する。
    image.png
    また、Webhook.site側ではRequestが確認できる。
    20250108_webhooksite_check.png
  3. Webhookが利用できるように、Webhookの利用をオンにする。
    image.png

3. LINEを操作してuserId等を取得する。

  1. Line Messaging APIでプッシュメッセージを送りたいトークルームを用意し、そこにLINE公式アカウントを招待する。
  2. トークルーム内で自分のアカウントでメッセージを送る。
    image.png
  3. しばらくすると、Webhook.site に新しいRequestが表示される。
    Raw Contentの、"events""source""userId"等が表示される。
    image.png

最後に

  • LINE Messageing API で正しくプッシュメッセージを送信できることを確認した後に、Webhookの利用をオフにすること。
  • 無料版のWebhook.siteはログインなしで動作するため、URLのIDを知っている人なら誰でもデータにアクセスできるようになっている。
    メニューの… MoreDelete URL...からデータを削除すること。
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?