Bot::ChatBots::Messenger::WebHook - WebHook for Bot::ChatBots::Messenger
use Mojolicious::Lite; plugin 'Bot::ChatBots::Messenger', helper_name => 'messenger', # default is chatbots.messenger instances => [ [ WebHook => path => '/messenger/yadda-yadda-yadda', processor => \&process, verify_token => 'yadda-yadda-yadda', ] ]; app->start; sub process { my $record = shift; # ... return $record; }
This module allows you to load a Mojolicious plugin for dealing with Facebook Messenger webhooks for a chatbot.
This module consumes role Bot::ChatBots::Role::WebHook, inheriting all the accessors. The accessors in the following subsections are added.
boolean flag to avoid routes generation upon plugin import. Used during the "BUILD" process. Defaults to 0, meaning that the routes will be generated (both "install_route" in Bot::ChatBots::WebHook and "install_get_route").
0
the verification token required by FaceBook to make sure your settings are accepted by your bot. You MUST set this or it will complain loudly upon calling "install_get_route".
This module consumes role Bot::ChatBots::Role::WebHook and implements or overrides the methods in the following subsections.
Called by Moo construction process. It uses "no_routes" to establish whether to call "install_route" in Bot::ChatBots::WebHook and "install_get_route" or not.
$obj->install_get_route(%args); # OR $obj->install_get_route(\%args);
Install the additional GET route for Facebook verification process. See "validation_token", which MUST be available for this method to work.
my $r = $obj->normalize_record($input_record);
Modify $input_record in-place and return it, trying to put it in some standard shape. Which has not been standardized yet.
$input_record
See "normalize_record" in Bot::ChatBots::Role::WebHook.
my @updates = $obj->parse_request($c->req);
See "parse_request" in Bot::ChatBots::Role::WebHook.
Report bugs either through RT or GitHub (patches welcome).
Foo::Bar.
Flavio Poletti <polettix@cpan.org>
Copyright (C) 2016 by Flavio Poletti <polettix@cpan.org>
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Bot::ChatBots::Messenger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::ChatBots::Messenger
CPAN shell
perl -MCPAN -e shell install Bot::ChatBots::Messenger
For more information on module installation, please visit the detailed CPAN module installation guide.