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!
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 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:
Why we ❤️ the OneSignal API
Our favorite thing about the OneSignal API is that it’s 100% free.
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.
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.
- First, you’ll need to head over to OneSignal and register for an account.
- After you create an account, go to RapidAPI’s OneSignal package page to make an API call from your browser.
- Fill in the
appIdfrom 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
appKey above your profile picture in the “Accounts & API keys” tab.
You can find the
appId from the “Keys & IDs” tab on the App Settings page of your app.
4. On the RapidAPI package page, pick your endpoint and fill in the parameters to make a 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…
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 (@Rapid_API) to make sure you don’t miss a single one. In the meantime, you can read our profiles on…
- NASA’s API
- Spotify’s public music API
- Lob’s mail delivery API
- GIPHY’s API
- Square’s eCommerce API
- Postmates delivery API
Whew! Let us know if you build anything cool in the comments below.