LINE.Bot.Webhook.Plug (line_bot_sdk v0.2.0)

Copy Markdown

A Plug for handling LINE Bot webhook requests.

This plug verifies the request signature, parses the JSON body, and assigns events and destination to the connection.

Usage

plug LINE.Bot.Webhook.Plug, channel_secret: "your_channel_secret"

The channel_secret option also accepts an {module, function, arguments} tuple to resolve the secret at runtime:

plug LINE.Bot.Webhook.Plug, channel_secret: {System, :fetch_env!, ["LINE_CHANNEL_SECRET"]}

On success, conn.assigns.webhook_payload will contain the CallbackRequest struct. On failure, the plug responds with 401 and halts the connection.