This add-on is operated by App Remix Corp
A simple, convenient way to deliver push notifications to your users.
Boxcar Push Notifications
Last updated December 06, 2023
This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.
The Boxcar Push Notifications add-on is currently in beta.
Table of Contents
Boxcar is Growl for the cloud! Boxcar is a simple way to let your users know that something happened, even when they’re not using your site. Use Boxcar to deliver real-time push notifications to iOS devices and Mac desktops. More operating systems coming soon!
Local setup
$ gem install boxcar_api
require 'rubygems'
require 'boxcar_api'
SETTINGS = {
:provider_key => 'xyz',
:provider_secret => 'xyz',
:email => 'user@example.com'
}
When developing locally, create a test provider at http://boxcar.io and store the provider key/secret.
bp = BoxcarAPI::Provider.new(SETTINGS[:provider_key], SETTINGS[:provider_secret])
When deploying via Heroku and the add-on catalog:
bp = BoxcarAPI::Provider.new(ENV['BOXCAR_URL'])
Subscribe a user to your service
res = provider.subscribe(email)
puts res.code
Deliver a personalized notification to a subscriber by email.
res = provider.notify(email, "This is an example message")
puts res.code
Deliver a personalized notification to a subscriber by email, but only deliver it once! This includes the from_remote_service_id for the user, which will ensure it’s only delivered one time.
res = provider.notify(email, "This is an example message. It should only be delivered once.", :from_remote_service_id => "123")
puts res.code
Deliver a notification with a custom screen name. This is added to the title as the user or application responsible for the message
res = provider.notify(email, "This is an example message from Rachel.", :from_screen_name => "Rachel")
puts res.code
You can also set a default screen name for notications when initializing your provider
another_provider = BoxcarAPI::Provider.new(provider_key, provider_secret, "Exmplr")
res = another_provider.notify(email, "This is an example message from Exmplr")
puts res.code
If you received a URL instead of a key and a secret, you can also create a provider from that:
url_provider = BoxcarAPI::Provider.new(:url => "http://boxcar.io/devices/providers/secretkey")
res = another_provider.notify(email, "This is an example message from a URL provider")
puts res.code
Deliver a notification with a source URL. This is the URL the user will be taken to when they open your message.
res = provider.notify(email, "You have an update.", :source_url => "http://example.com/status/1312430")
puts res.code
Deliver a notification with an icon.
res = provider.notify(email, "You have an update.", :icon_url => "http://example.com/public/icon")
puts res.code
Deliver a notification to a subset of your subscribers.
users = ["user1@example.com", "user2@example.com"]
res = provider.batch_notify(users, "This is a batch example message.", :from_screen_name => "Support", :from_remote_service_id => "123", :source_url => "http://example.com/status/1312430")
puts res.code
Deliver a broadcast notification to everyone that has added your service.
res = provider.broadcast("This is an example message.", :icon_url => "http://example.com/public/icon", :from_remote_service_id => "1232331")
puts res.code
Further reading (including raw API documentation):
Deploying to Heroku
To use Boxcar on Heroku, install the Boxcar add-on:
$ heroku addons:create boxcar