Parse incoming LINE webhook payloads into event structs.
parse/1 is total — it never raises. This is required for forward
compatibility: LINE adds new event/message types, enum values, and fields without
notice, and the server must keep working
(dev guidelines).
Accordingly:
- an unrecognized event/message
typedegrades toExLine.Webhook.Event.Unknown/ExLine.Webhook.Message.Unknown(mirroring the official SDKs), - unknown fields are ignored (the original payload is kept in each struct's
raw), - a single malformed event degrades to
Event.Unknownrather than failing the batch.
Verify the signature first with ExLine.Webhook.Signature / ExLine.Webhook.Plug.
Example
body |> Jason.decode!() |> ExLine.Webhook.parse() |> Enum.each(&MyRouter.call/1)Ref: https://developers.line.biz/en/reference/messaging-api/#webhook-event-objects
Summary
Functions
Parses a decoded webhook request (%{"events" => [...]}) or a list of raw events
into a list of event structs.
Parses a single raw event map into an event struct. Never raises — anything it
can't model becomes an Event.Unknown.
Types
@type event() :: ExLine.Webhook.Event.Message.t() | ExLine.Webhook.Event.Postback.t() | ExLine.Webhook.Event.Follow.t() | ExLine.Webhook.Event.Unfollow.t() | ExLine.Webhook.Event.Join.t() | ExLine.Webhook.Event.Leave.t() | ExLine.Webhook.Event.MemberJoined.t() | ExLine.Webhook.Event.MemberLeft.t() | ExLine.Webhook.Event.Unsend.t() | ExLine.Webhook.Event.VideoPlayComplete.t() | ExLine.Webhook.Event.Beacon.t() | ExLine.Webhook.Event.AccountLink.t() | ExLine.Webhook.Event.Membership.t() | ExLine.Webhook.Event.Activated.t() | ExLine.Webhook.Event.Deactivated.t() | ExLine.Webhook.Event.BotSuspended.t() | ExLine.Webhook.Event.BotResumed.t() | ExLine.Webhook.Event.Module.t() | ExLine.Webhook.Event.PnpDeliveryCompletion.t() | ExLine.Webhook.Event.Unknown.t()
Functions
Parses a decoded webhook request (%{"events" => [...]}) or a list of raw events
into a list of event structs.
Parses a single raw event map into an event struct. Never raises — anything it
can't model becomes an Event.Unknown.