Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JavaScript Perl
branch: master

Merge pull request #1 from c9s/api

Added a basic Api controller
latest commit b3b27b577a
@c9s c9s authored

README.mkdn

Social

Installing

Social is implemented with Perl, you do not need to install itself to get it working, but it requires following CPAN modules to be installed:

  • Encode
  • YAML
  • AnyEvent::IRC
  • FindBin
  • HTML::Entities
  • Plack
  • Plack::Request
  • Tatsumaki
  • AnyEvent::Twitter
  • AnyEvent::Plurk
  • RTPG
  • AnyEvent::RTPG
  • JSON::XS

Running It

At this point, you do not install the Social itself in order to run it. Just cd into the source tree and execute the "social" program.

You need to provide a path to your config file like this:

./social -c /path/to/config.yml

See config/social.yml for the example and description of the configrable content.

API Controller

Social provides an API controller, you can send messages from the API.

For example,

#!/usr/bin/env perl
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON::XS;
use URI;
my $network = ...;
my $channel = ...;
my $msg = shift;
$ua = LWP::UserAgent->new;
my $uri = URI->new( 'http://localhost:9999/api' );
$uri->query_form({ payload => encode_json({ network => $network , channel => $channel , message => $msg }) });
$response = $ua->request(GET $uri );
warn $response->content;
Something went wrong with that request. Please try again.