LINE-Bot-API

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


        my $messages = LINE::Bot::API::Builder::SendMessage->new(
        )->add_audio(
            audio_url => 'http://example.com/image.m4a',
            duration  => 3601_000, # msec
        );
        $bot->reply_message($reply_token, $messages->build);

 Location type

    Build a location type object.

        my $messages = LINE::Bot::API::Builder::SendMessage->new(
        )->add_location(
            title     => 'LINE Corporation.',
            address   => 'Hikarie  Shibuya-ku Tokyo 151-0002',
            latitude  => 35.6591,
            longitude => 139.7040,
        );
        $bot->reply_message($reply_token, $messages->build);

 Sticker type

    Build a sticker type object.

        my $messages = LINE::Bot::API::Builder::SendMessage->new(
        )->add_sticker(
            package_id => '1',
            sticker_id => '2',
        );
        $bot->reply_message($reply_token, $messages->build);

 Imagemap type

    To build a message of imagemap type, you may use a helper module.

        my $imagemap = LINE::Bot::API::Builder::ImagemapMessage->new(
            base_url    => 'https://example.com/bot/images/rm001',
            alt_text    => 'this is an imagemap',
            base_width  => 1040,
            base_height => 1040,
        )->add_uri_action(
            uri         => 'http://example.com/',
            area_x      => 0,
            area_y      => 0,
            area_width  => 1040,
            area_height => 520,
        )->add_message_action(
            text        => 'message',
            area_x      => 0,
            area_y      => 520,
            area_width  => 1040,
            area_height => 520,
        );
    
        my $messages = LINE::Bot::API::Builder::SendMessage->new(
        )->add_imagemap($imagemap->build);
        $bot->reply_message($reply_token, $messages->build);

    An Imagemap message can contain a video area inside. Here is an example
    of one withe upper half being a video overlay:

        my $imagemap_message = LINE::Bot::API::Builder::ImagemapMessage->new(
            base_url    => 'https://example.com/bot/images/rm001',
            alt_text    => 'this is an imagemap',
            base_width  => 1040,
            base_height => 1040,
            video => {
                originalContentUrl => "https://example.com/video.mp4",
                previewImageUrl => "https://example.com/video_preview.jpg",
                area => {
                    x => 0,
                    y => 0,
                    width => 1040,
                    height => 585
                }
            }
        )->build;

    For more detail about Imagemap message, see:
    https://developers.line.biz/en/reference/messaging-api/#imagemap-message

 Template type

    Build a template type object. You can use a helper module for the
    template type.

  Buttons type

        my $buttons = LINE::Bot::API::Builder::TemplateMessage->new_buttons(
            alt_text  => 'this is a buttons template',
            image_url => 'https://example.com/bot/images/image.jpg',
            title     => 'buttons',
            text      => 'description',
        )->add_postback_action(
            label => 'postback',
            data  => 'postback data',
            text  => 'postback message',
        )->add_message_action(
            label => 'message',
            text  => 'message',
        )->add_uri_action(
            label => 'uri',
            uri   => 'http://example.com/',
        )->add_message_action(
            label => 'message2',
            text  => 'message2',
        );
    
        my $messages = LINE::Bot::API::Builder::SendMessage->new(
        )->add_template($buttons->build);
        $bot->reply_message($reply_token, $messages->build);

  Confirm type

        my $confirm = LINE::Bot::API::Builder::TemplateMessage->new_confirm(
            alt_text => 'this is a confirm template',
            text     => 'confirm',
        )->add_postback_action(
            label => 'postback',
            data  => 'postback data',



( run in 0.856 second using v1.01-cache-2.11-cpan-e1769b4cff6 )