Webhook
LINE's server sends user actions (messages, images, locations, etc.) to your bot server as webhook events.
Handling webhooks
- Receive the webhook request from LINE.
- Parse the request body with
EventRequestParser. - Handle each event.
use LINE\Parser\EventRequestParser;
$parsedEvents = EventRequestParser::parseEventRequest(
$body,
$channelSecret,
$signature,
);
foreach ($parsedEvents->getEvents() as $event) {
// Handle event
}
See the example implementations: