LINE-Bot-API
view release on metacpan or search on metacpan
say $ret->user_id;
say $ret->picture_url;
}
See also the LINE Developers API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-group-member-profile
get_member_in_room_count($room_id)
Gets the count of members in a room. You can get the member in room
count even if the user hasn't added the LINE Official Account as a
friend or has blocked the LINE Official Account.
my $ret = $bot->get_member_in_room_count($room_id);
if ($ret->is_success) {
say $ret->count;
}
See also the LINE Developers API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-members-room-count
get_member_in_group_count($group_id)
Gets the count of members in a group. You can get the member in group
count even if the user hasn't added the LINE Official Account as a
friend or has blocked the LINE Official Account.
my $ret = $bot->get_member_in_group_count($group_id);
if ($ret->is_success) {
say $ret->count;
}
See also the LINE Developers API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-members-group-count
get_group_summary($group_id)
Gets the group ID, group name, and group icon URL of a group where the
LINE Official Account is a member.
my $ret = $bot->get_group_summary($group_id);
if ($ret->is_success) {
say $ret->group_id;
say $ret->group_name;
say $ret->picture_url;
}
See also the LINE Developers API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-group-summary
get_room_member_profile($room_id, $user_id)
Get room user profile information. A room is like a group without a
group name. The response is similar to get_group_member_profile.
See also the LINE Developers API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-room-member-profile
get_number_of_sent_reply_messages($date)
Gets the number of messages sent with the /bot/message/reply endpoint.
The number of messages retrieved by this operation does not include the
number of messages sent from LINE@ Manager.
The $date parameter is "yyyyMMdd" format.
get_number_of_sent_push_messages($date)
Gets the number of messages sent with the /bot/message/push endpoint.
The number of messages retrieved by this operation does not include the
number of messages sent from LINE@ Manager.
date
Date the messages were sent
Format: yyyyMMdd (Example: 20191231)
Timezone: UTC+9
get_number_of_sent_multicast_messages($date)
Gets the number of messages sent with the /bot/message/multicast
endpoint.
The number of messages retrieved by this operation does not include the
number of messages sent from LINE@ Manager.
date
Date the messages were sent
Format: yyyyMMdd (Example: 20191231)
Timezone: UTC+9
get_number_of_send_broadcast_messages($date)
Gets the number of messages sent with the /bot/message/broadcast
endpoint.
The number of messages retrieved by this operation does not include the
number of messages sent from LINE Official Account Manager.
date
Date the messages were sent
Format: yyyyMMdd (Example: 20191231)
Timezone: UTC+9
create_rich_menu( $rich_menu_object )
This method corresponds to the API of Creating rich menu
<https://developers.line.biz/en/reference/messaging-api/#create-rich-menu>
One argument is needed: $rich_menu_object, which is a plain HashRef
representing rich menu object
<https://developers.line.biz/en/reference/messaging-api/#rich-menu-object>
get_rich_menu( $rich_menu_id )
This method corresponds to the API of Get rich menu
<https://developers.line.biz/en/reference/messaging-api/#get-rich-menu>
One argument is needed: $rich_menu_id -- which correspond to the
richMenuId property of the object returned by create_rich_menu method.
delete_rich_menu( $rich_menu_id )
This method corresponds to the API of Delete rich menu
<https://developers.line.biz/en/reference/messaging-api/#delete-rich-menu>
One argument is needed: $rich_menu_id -- which correspond to the
richMenuId property of the object returned by create_rich_menu method.
The return value is an empty RichMenu object -- only status code
matters. Upon successful deletion, status code 200 is returned.
get_rich_menu_list
This method corresponds to the API of Get rich menu list
<https://developers.line.biz/en/reference/messaging-api/#get-rich-menu-list>
No arguments are needed.
set_default_rich_menu( $rich_menu_id )
This method corresponds to the API of Set default rich menu
<https://developers.line.biz/en/reference/messaging-api/#set-default-rich-menu>
One argument is needed: $rich_menu_id -- which correspond to the
richMenuId property of the object returned by create_rich_menu method.
get_default_rich_menu_id
This method corresponds to the API of Get default rich menu ID
<https://developers.line.biz/en/reference/messaging-api/#get-default-rich-menu-id>
No arguments are needed. The return value is a RichMenu object with
jwt => "...",
}
This method is for getting all valid channel access token key IDs.
When a 200 OK HTTP response is returned, a new token is issued. In this
case, you may want to store the values in "key_ids" attributes of the
response object for future use.
Otherwise, you may examine the "error" attribute and
"error_description" attribute for more information about the error.
revoke_channel_access_token({ access_token => "..." })
This method corresponds to the API of: Revoke channel access token
<https://developers.line.biz/en/reference/messaging-api/#revoke-channel-access-token>
The argument is a HashRef with one pair of mandatory key-values;
{ access_token => "..." }
Upon successful revocation, a 200 OK HTTP response is returned.
Otherwise, you my examine the "error" attribute and "error_description"
attribute for more information about the error.
get_number_of_followers({ date => "..." })
This method corresponds to the API of: Get number of followers
<https://developers.line.biz/en/reference/messaging-api/#get-number-of-followers>
The argument is a HashRef with one pair of mandatory key-values;
{ date => "20191231" }
The formate of date is "yyyyMMdd", that is, year in 4 digits, month in
2 digits, and date-of-month in 2 digits.
Upon successful invocation, a 200 OK HTTP response is returned.
Otherwise, you my examine the "error" attribute and "error_description"
attribute for more information about the error.
The return value $res is a response object with the following read-only
accessors (see the API documentation for the meaning of each.)
$res->status(); #=> Str, one of: "ready", "unready", "out_of_service"
$res->followers(); #=> Num
$res->targetedReaches(); #=> Num
$res->blocks(); #=> Num
Notice that the "status" does not mean HTTP status. To inspect actual
HTTP status, invoke $res-http_status()>.
get_user_interaction_statistics({ requestId => "..." })
Returns statistics about how users interact with narrowcast messages or
broadcast messages sent from your LINE Official Account.
See also the LINE Developers API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-message-event
set_webhook_url({ 'endpoint' => "https://example.com/webhook" })
Sets the webhook endpoint to te given endpoint, which should be an URL
string.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#set-webhook-endpoint-url
get_webhook_endpoint_information()
Return the information about webhook endpoint as an response object
with following accessors:
$res = $api->get_webhook_endpoint_information();
$res->endpoint(); # URL as a string
$res->active(); # true or false
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information
test_webhook_endpoint({ 'endpoint' => "https://example.com/webhook" })
Checks if the configured webhook endpoint can receive a test webhook
event.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-webhook-endpoint-information
validate_reply_message_objects([ $message, ... ] )
Validates that an array of message objects is valid as a value for the
messages property of the request body for the Send reply message
endpoint.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-reply-message
validate_push_message_objects([ $message, ... ] )
Validates that an array of message objects is valid as a value for the
messages property of the request body for the Send push message
endpoint.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-push-message
validate_multicast_message_objects([ $message, ... ] )
Validates that an array of message objects is valid as a value for the
messages property of the request body for the Send multicast message
endpoint.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-multicast-message
validate_narrowcast_message_objects([ $message, ... ] )
Validates that an array of message objects is valid as a value for the
messages property of the request body for the Send narrowcast message
endpoint.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-narrowcast-message
validate_broadcast_message_objects([ $message, ... ] )
Validates that an array of message objects is valid as a value for the
messages property of the request body for the Send broadcast message
endpoint.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#validate-message-objects-of-broadcast-message
get_followers({ 'limit' => 100, 'start' => "..." })
Gets the list of User IDs of users who have added LINE Official Account
as a friend.
See also the LINE Developer API reference of this method:
https://developers.line.biz/en/reference/messaging-api/#get-follower-ids
How to build a send message object
See the LINE Developers API reference about Message objects
<https://developers.line.biz/en/reference/messaging-api/#message-objects>
When the LINE::Bot::API::Builder::SendMessage class is used, it is
possible easily to build a send message object. That class supports a
fluent interface.
my $messages = LINE::Bot::API::Builder::SendMessage->new(
)->add_text(
text => 'Closing the distance',
)->add_image(
image_url => 'http://example.com/image.jpg',
preview_url => 'http://example.com/image_preview.jpg',
);
$bot->reply_message($reply_token, $messages->build);
Text type
Build a text type object.
my $messages = LINE::Bot::API::Builder::SendMessage->new(
)->add_text(
text => 'Closing the distance',
);
$bot->reply_message($reply_token, $messages->build);
Build a text message with emojis inside:
my $message = LINE::Bot::API::Builder::SendMessage->new();
$message->add_text(
text => '$ LINE Emoji $',
emojis => [
+{
"index" => 0,
"productId" => "5ac1bfd5040ab15980c9b435",
"emojiId" => "001"
},
+{
"index" => 13,
"productId" => "5ac1bfd5040ab15980c9b435",
"emojiId" => "002"
}
]
);
Since 2020/04/16, text messages may contain LINE emojis. They are
( run in 1.926 second using v1.01-cache-2.11-cpan-524268b4103 )