Git Product home page Git Product logo

facebook-messenger-perl's Introduction

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 reply-bot.pl example here.

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

# bot.pl
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
}

$bot->spin();

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

> plackup -S Starman bot.pl

...to make your webhook accessible to Facebook with whatever method you feel most comfortable with :)

This work is mildly and loosely based on this.

Author

David Moreno.

This is massively incomplete anyway

Thanks for looking :)

facebook-messenger-perl's People

Contributors

damog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.