Skip to content

webhook quick start

찰스 edited this page Aug 2, 2023 · 1 revision

webhook api quick start

This is a simple test through WebHook. if you'd like to webhook test quickly using LINE Developers.NET, please following below description step by step.

quick start

  • Messaging API → issue and copy to Channel access token (long-lived)

2. open webhook api sample project

  1. download line webhook sample project
  2. Visual Studio → open line webhook sample project
  3. modify to your Channel access token in LineController constructor
  • LineController.cs
public LineController()
{
    _client = new LineMessagingClient("your channel access token"); //here
}
  1. Visual Studio → F5
  2. take a note or remember of your localhost address and callback url.

3. install ngrok & setting

need to follow the below process for LINE Messenger Serever call directly your local webhook address.

3-1. Download the ngrok what your proper PC environment

3-2. ngrok

  1. run ngrok with your local host in console
    ngrok http https://localhost:7250/
  2. copy created host via ngrok image

4. register Webhook url in LINE Developers

image

  1. LINE Developers Console → Messaging API → Webhook settings
  2. Use webhhook ✔
  3. Webhook URL → Edit → ngrok host + callback url → Update → Verifiy → Success

5. LINE Messanger

If you type some text on your channel, you'll get the message from LINE messenger which is set the webhook.

sample source

LINE Developers Methods
Message event OnMessageEventAsync
Unsend event OnUnSendEventAsync
Follow event OnFollowEventAsync
Unfollow event OnUnFollowEventAsync
Join event OnJoinEventAsync
Leave event OnLeaveEventAsync
Member join event OnMemberJoinEventAsync
Member leave event OnMemberLeaveEventAsync
Postback event OnPostBackEventAsync
Video viewing complete event OnVideoViewingCompleteEventAsync
Beacon event OnBeaconEventAsync
Account link event OnAccountLinkEventAsync
Device link event OnThingsEventAsync
Device unlink event OnThingsEventAsync
LINE Things scenario execution event OnThingsEventAsync