You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```ParseRequest()``` will help you to parse the ```*http.Request``` content and return a slice of Pointer point to Event Object.
61
+
The LINE Messaging API primarily utilizes the JSON data format. To parse the incoming HTTP requests, the `webhook.ParseRequest()` method is provided. This method reads the `*http.Request` content and returns a slice of pointers to Event Objects.
The LINE Messaging API defines 7 types of event - ```EventTypeMessage```, ```EventTypeFollow```, ```EventTypeUnfollow```, ```EventTypeJoin```, ```EventTypeLeave```, ```EventTypePostback```, ```EventTypeBeacon```. You can check the event type by using ```event.Type```
74
+
The LINE Messaging API is capable of handling various event types. The Messaging API SDK automatically unmarshals these events into respective classes like `webhook.MessageEvent`, `webhook.FollowEvent`, and so on. You can easily check the type of the event and respond accordingly using a switch statement as shown below:
75
+
64
76
65
77
```go
66
-
for_, event:=range events {
67
-
if event.Type == linebot.EventTypeMessage {
68
-
// Do Something...
78
+
for_, event:=range cb.Events {
79
+
switche:= event.(type) {
80
+
case webhook.MessageEvent:
81
+
// Do Something...
82
+
case webhook.StickerMessageContent:
83
+
// Do Something...
69
84
}
70
85
}
71
86
```
@@ -75,9 +90,9 @@ for _, event := range events {
75
90
To send a message to a user, group, or room, you need either an ID
0 commit comments