Skip to content

Instantly share code, notes, and snippets.

@mremond
Created March 10, 2014 09:51
Show Gist options
  • Save mremond/9462192 to your computer and use it in GitHub Desktop.
Save mremond/9462192 to your computer and use it in GitHub Desktop.
!/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',
);
@geoffdavis
Copy link

slight nitpick: you're missing the # at the beginning of the first line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment