Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
!/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

This comment has been minimized.

Copy link

commented May 15, 2015

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
You can’t perform that action at this time.