line_bot v0.1.0 LineBot.Webhook View Source

This module is a Plug that handles incoming events from the Line server, and forwards them to your LineBot callback.

It is recommended that you set up your own Plug.Router, and forward requests to the webhook URL to this plug, like this:

forward "/bot", to: LineBot.Webhook, callback: YourCallbackModule

This plug will read, validate, and parse the request body, so it must not appear in the same pipeline as other plugs such as Plug.Parsers that also read the request body.

Note: The verify button in the Developer Center when saving the webhook URL sends dummy data. This module replies to that request directly, rather than forwarding the request to your callback.

Skipping Validation

By default, requests are validated against the X-Line-Signature header. If the signature cannot be validated, a 403 Forbidden response is returned.

During development, it may be convenient to temporarily disable this behaviour. This can be achieved via configuration by setting :skip_validation to true.

config :line_bot, skip_validation: true

Link to this section Summary

Functions

Callback implementation for Plug.call/2.

Called when this plug is initialized. Expects an implementation of LineBot to be passed as the :callback option.

Link to this section Functions

Callback implementation for Plug.call/2.

Called when this plug is initialized. Expects an implementation of LineBot to be passed as the :callback option.