Adding Push Services to your backend
Adding Push Services is a bit tricky because every platform has its own service and its own way to activate notifications. But if you follow our guide, your Push Service will be up and running in just a few minutes.
In your project's Admin Dashboard, click on Push Notification -> Push Services (see image below). You can add and configure new services by clicking the
Add button of one of the supported Push Services. Successfully configured services can be enabled or disabled by using the ON/OFF switch, meaning that mobile push endpoints can or cannot connect to this Push Service.
Google Cloud Messaging (GCM)
a) Create new project at https://console.firebase.google.com/
b) In your new firebase project, open Project Settings (Configuration symbol next to project name) and select Cloud Messaging tab to find the required
Server key credential along with your
Sender ID which you will need in your client code configuration later.
c) In your Selfbits Push Service view, ADD a GCM Push Service and enter the Cloud Messaging
Server key as credential. Use a display name that suits you. To identify your Push Service, you should also copy and paste your
Sender ID along with other helpful information in Notes.
d) Save your configuration. If the credentials are correct, you receive a success message and your Push Service is enabled.
Apple Push Notification Service (APNS)
a) Create an iOS App with unique Bundle-ID
If you didn't create an App Store entry for your app, go to your Apple Account at https://developer.apple.com/account, open
iTunes Connect, create an new app and choose a unique Bundle-ID (Example Inc. would probably choose
org.example.helloworld for its new Hello World app).
b) Get your App's APNS SSL Certificate
Go to your Apple Account at https://developer.apple.com/account and open
Certificates, IDs & Profilesmenu, then open
Certificates -> Productionand create a new Apple Push Notification Service SSL (Sandbox & Production) certificate. Follow the instructions and download the final certificate
Convert your certificate from .cer to .pem format. You can use OpenSSL for this task:
openssl x509 -in my_example_apns_cert.cer -inform DER -out my_example_apns_cert.pem
c) Obtain the App Private Key
- On your MAC computer, import the already downloaded
my_example_apns_cert.cer in your
Keychain Access (double click).
- Open the
Keychain Access application, open your Certificates and expand your APNS SSL Certificate entry to see the associated
App Private Key.
- Right click on the
Private Key and press export.
- The exported key has to be converted from .p12 to .pem format. Again you can use OpenSSL:
openssl pkcs12 -in my_apns_app_privatekey.p12 -out my_apns_app_privatekey.pem -nodes -clcerts
d) Create APNS Push Service in your Selfbits Backend
- Enter the textual content of
my_apns_app_privatekey.pem as Credential:
-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----
- Enter the textual content of
-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----
- Use a display name that suits you and optionally add some notes about your Push Service.
e) Save your configuration. If the credentials are correct, you receive a success message and your Push Service is enabled.