Perl interface for the Facebook Messenger API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Perl bindings for the Facebook Messenger API

This is currently a work in progress to implement the Facebook Messenger API for friendly Perl usage :)

So far this is a quick example of what you can build:

The source code for that example is on the example here.

But basically the interface should be super simple and clean with something like this:

use Facebook::Messenger::Bot;

my $bot = Facebook::Messenger::Bot->new({
	access_token   => '...',
	app_secret     => '...',
	verify_token   => '...'

$bot->register_hook_for('message', sub {
	my $bot = shift;
	my $message = shift;

	my $res = $bot->deliver({
		recipient => $message->sender,
		message => { text => "You said: " . $message->text() }

$bot->register_hook_for('postback', sub {
    my $bot = shift;
    my $postback = shift;

    # ... do things here


The actual spinning, you can hook up to whatever framework or application that supports PSGI/Plack, with something like:

> plackup -S Starman make your webhook accessible to Facebook with whatever method you feel most comfortable with :)

This work is mildly and loosely based on this.


David Moreno.

This is massively incomplete anyway

Thanks for looking :)