Getting started with Pusher Beams
Push notifications are a pivotal part of mobile applications. They can be used for a wide range of applications. From marketing to keeping a user updated on a delivery to informing them they have a message from a friend. As mobile devices become more integral to the way we live so do push notifications to our apps. However for developers this means it’s often not just as simple as registering a device token and sending a generic notification to all our users. We want to enrich the user experience and make it unique. Pusher Beams gives us the opportunity to easily make and send custom notifications to our users. We will look at how you can quickly get a Pusher Beams instance created in the Pusher dashboard.
Set up Pusher Beams
Note: You will need an Apple developer account to fully complete the setup however you can skip that part of this tutorial if you don’t have one. You just won’t be able to send notifications to a device until you complete either this or the Android “Get Started”. Depending upon the type of device you would like to send messages to.
To set up a Pusher Beams instance you will need to go here. You will either need to create a new Pusher account or log in to your existing one. Once you are logged in you should see your Pusher dashboard like below.
Here we can create a new instances for Pusher products such as Chatkit and Beams. We’re going to go ahead and create a new beams instance. Click the CREATE button for Beams and you should see the following.
Give your new instance a name and press create. You can call it anything you want.
We’re going to follow the IOS Quickstart guide here. Don’t worry though if you’re on Android or don’t want to follow either. The guide is super simple to follow and walks you through the steps, you can also come back to it at a later date. If you don’t want to follow the iOS or Android guide press the X in the top right and pick up this tutorial at “Pusher Beams dashboard”.
After selecting the iOS quick start you will be presented with the above screen. Follow the highlighted link to create a new APNs key. Sign in to your Apple developer account and you will see the following page.
Note: You can only have a total of two APNs keys for each account. Each key can be used for multiple instances and they can only be downloaded once so keep it somewhere safe and share it with team members.
Click Continue and Confirm your configuration on the next page. Finally click **Download and return to your Pusher Beams quickstart guide and upload it. You will then need to add your team ID which you can get by following the other hyperlink on the page before continuing. Press CONTINUE and then the X and confirm you wish to exit. If you wish you may continue the setup to add the pod to an iOS application however we will not be doing that now.
Pusher Beams instance dashboard
You will now have been presented with your Pusher Beams instance dashboard. Take some time to look around this dashboard. You will see some insights available to you such as active devices and information about published notifications. Currently no information will be displayed except your plan limit as we haven’t sent a notification.
You will see a set of tabs at the top of your dashboard. The credentials tab includes important information about your instance, you will need the instance ID and secret keys when setting up and using the Pusher Beams client or server SDKs. You can also integrate directly with the Pusher API’s. More information on this can be found in the docs.
The debug console allows us to send debug notifications to interests that we have registered within our app. Users subscribe to interests, or more accurately we subscribe users to interests. In the below example anybody subscribed to the
debug-general interest would receive a push notification. Subscribing users to certain interests is a powerful way of making sure users only receive notifications that they want. For more information visit the docs here.
Finally the settings tab is where we can update our APN’s or FCM server keys. We can also add our team members or change the instance name and even delete the instance here.
Custom notifications are vital to the way modern applications need to interact with their users. Custom in this sense doesn’t necessarily mean that we need to customize the message, however that is one example. Custom messages might be that we only want to target select groups of users or maybe even a single user. With Pusher Beams we can use the server SDKs to help make this simple.
Pusher has a selection of server SDKs that can be found in the docs. Along with this there are lots of tutorials that will help you setup your chosen server. We can use a database on the server to store information about users. It could be that each user has their own unique interest so they are the only ones to receive those notifications. It could be that the user has multiple interests or that the payload (the content of the notification) needs customising for certain interests. Using a server to handle this logic means that our app doesn’t need to be running and we can customise user notifications from our server at any time.
You could use the server SDK’s to create your a custom publishing tool for your marketing teams or you could have a separate system that automatically generates push notifications for a chat app, that may or may not be using Chatkit.
We’ve seen how we can quickly create a Pusher Beams instance and we’ve had a whirlwind tour of the Pusher Beams dashboard. The next step (if you haven’t already done it) is to add the client SDKs and send some notifications from the dashboard. Then we can look at sending custom notifications using the server SDKs or creating our own custom publishing tool.
Every application is unique and so is every user. Pusher Beams gives us the opportunity to implement a unique push notification service for those users the way we as developers need to for our applications.
© 2019 Pusher Ltd. All rights reserved.
Pusher Limited is a company registered in England and Wales (No. 07489873) whose registered office is at 160 Old Street, London, EC1V 9BW.