Created
March 10, 2014 09:51
-
-
Save mremond/9462192 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/usr/bin/perl -w | |
require LWP::UserAgent; | |
my $ua = LWP::UserAgent->new; | |
my $boxcarurl = 'https://new.boxcar.io/api/notifications'; | |
# Put your Boxcar token in this file: | |
my $accesstoken = `cat ~/.boxcartoken`; | |
chomp($accesstoken); | |
sub boxcarpush { | |
my %notification = @_; | |
my %fields = ( | |
'user_credentials' => $accesstoken, | |
); | |
foreach (keys %notification) { | |
$fields{"notification[$_]"} = $notification{$_}; | |
} | |
$ua->post($boxcarurl, \%fields); | |
} | |
boxcarpush( | |
title => 'message title', | |
long_message => 'Okay, this is <b>fun</b>.', | |
sound => 'bird-1', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slight nitpick: you're missing the
#
at the beginning of the first line.