NAME
LINE::Bot::API::Receive - Handler for recieving events from LINE Bot API
SYNOPSIS
use strict;
use warnings;
use LINE::Bot::API;
my $bot = LINE::Bot::API->new(
channel_id => 'YOUR LINE BOT Channel ID',
channel_secret => 'YOUR LINE BOT Channel Secret',
channel_mid => 'YOUR LINE BOT MID',
);
my $requests = $bot->create_requests_from_json($json);
for my $req (@{ $requests }) {
if ($req->is_message) {
say $req->content_id;
say $req->from_mid;
say $req->created_time; # createdTime
if ($req->is_text) {
say $req->text;
} elsif ($req->is_image) {
# LINE::Bot::API::Receive::Message::Image has no getter method
} elsif ($req->is_video) {
# LINE::Bot::API::Receive::Message::Video has no getter method
} elsif ($req->is_audio) {
# LINE::Bot::API::Receive::Message::Audio has no getter method
} elsif ($req->is_location) {
say $req->text; # alias of title
say $req->title;
say $req->address;
say $req->latitude;
say $req->longitude;
} elsif ($req->is_sticker) {
say $req->stkpkgid;
say $req->stkid;
say $req->stkver;
say $req->stktxt;
} elsif ($req->is_contact) {
say $req->mid;
say $req->display_name;
}
} elsif ($req->is_operation) {
say $req->revision;
say $req->from_mid;
if ($req->is_add_contact) {
# LINE::Bot::API::Receive::Operation::AddContact has no getter method
} elsif ($req->is_block_contact) {
# LINE::Bot::API::Receive::Operation::BlockContact has no getter method
}
}
}
DESCRIPTION
LINE::Bot::API::Receive is a handler to receive events from LINE BOT API. Allows you to easily handle operatiion messages.
Using instance method directly is not-recommended. Please use create_requests_from_json($json) of LINE::Bot::API instead.
See also LINE Developers - BOT API - API reference for more deitals of these package's getter method.
COPYRIGHT & LICENSE
Copyright 2016 LINE Corporation
This Software Development Kit is licensed under The Artistic License 2.0. You may obtain a copy of the License at https://opensource.org/licenses/Artistic-2.0