OneSignal API Profile: Add Push Notifications to Your App

Lindsey at RapidAPI
The Era of APIs
Published in
5 min readDec 29, 2016

We’re back with 12 Days of APIs! Today, we’re profiling One Signal’s push notification API with some help from co-founder and CEO George Deglin. Read on for more info or jump straight to the package page to start making calls!

screen-shot-2016-12-29-at-6-55-46-am

What does the OneSignal API do?

The OneSignal API is all about push notifications. For the uninitiated, push notifications are short messages that pop up on a mobile device or desktop, even if the user is not logged into the app in question. For example, here’s what a push notification looks like on an iPhone.

push-notification

Push notifications are pretty darn universal in this day and age. One Signal cites one study that reports that the average person receives 63.5 push notifications on mobile per day (and that was in 2014!).

If you’re building a web or mobile app, you’ll probably want push notification functionality. With the OneSignal API, you can add custom push notifications to the following devices:

screen-shot-2016-12-29-at-7-45-57-am

Why we ❤️ the OneSignal API

Our favorite thing about the OneSignal API is that it’s 100% free.

screen-shot-2016-12-29-at-5-33-06-pm

There aren’t any limits on calls, notifications, devices or integrations. They also give you full access to push notification analytics so you can A/B test them.

So, how do they make money, you ask? Good question. They make money by offering custom solutions to enterprise customers and from aggregating and selling data.

Use cases for the OneSignal API

Add push notifications to your app

George explained to us that the most common use cases for the API are adding customizable push notifications to your website, app or service. The API gives developers control over notification scheduling, personalization and design. You can A/B test design or different scheduled times so your notifications are optimized for best performance.

While OneSignal has some big name companies that use their API (like a little car rental company called Uber), George highlighted OneSignal’s integration with ProductHunt.

product-hunt

ProductHunt uses OneSignal’s API to send marketing notifications. For example, when a product receives comments, people in that thread are notified through the OneSignal API.

Link OneSignal to other services

Not all OneSignal’s use cases are user-facing, however. George also gave an example of developers using the OneSignal API to optimize their workflow. For example, the OneSignal API can be used to notify you when a blog post is published or if someone creates a pull request on your repo. Basically, if there’s anything you wish had a push notification, you can make one with OneSignal.

How to call the OneSignal API

Ok, we’ve talked a lot about the OneSignal API. Here’s how you actually call it.

lets-go
  1. First, you’ll need to head over to OneSignal and register for an account.
  2. After you create an account, go to RapidAPI’s OneSignal package page to make an API call from your browser.
  3. Fill in the userKey, appKey and appId from the OneSignal website. We made some GIFs below so that you could see where (note: we did not display the actual API keys for security purposes).

You’ll find the userKey and appKey above your profile picture in the “Accounts & API keys” tab.

onesignal-appkey-userkey

You can find the appId from the “Keys & IDs” tab on the App Settings page of your app.

onesignal-appid

4. On the RapidAPI package page, pick your endpoint and fill in the parameters to make a call.

onesignal-sample-call

Once you’ve made a call successfully, you can export the code used to call the API into your script. Just pick your language of choice and copy the code directly into your app. If you’re calling multiple APIs, you can call them from a single RapidAPI endpoint. Go ahead and try it yourself here!

Behind the scenes of the OneSignal API

We couldn’t leave our interview with George without getting more insight into the OneSignal API — it’s got some pretty impressive stats. According to George, the OneSignal API…

  • Handles 400K+ API requests per minute (and at peak times, handles 10K requests per second)
  • Sends notifications to over 1B devices
  • Is in use by over 100K developers

That’s one heavy duty API. Our reaction was something like this…

damn

George said that the API was written in Ruby and they focused on building scalability into the design. They’re full stack includes Ruby, Rails, Rspec, Coffeescript, PostgreSQL, and Redis.

Need more side project ideas? There’s still more API profiles!

We’ve still got a few more days of our #12DaysOfAPIs profiles! Follow along on our blog, Facebook or Twitter to make sure you don’t miss a single one. In the meantime, you can read our profiles on…

Let us know if you build anything cool in the comments below.

--

--

Lindsey at RapidAPI
The Era of APIs

Director of Content at RapidAPI, a platform that helps developers find and connect directly to the world’s top APIs.