Kevin McGahey - March 15, 2017

DreamFactory 2.5 now supports Apple Push Notification Service (APNs). This blog post will show you how easy it is configure DreamFactory as your iOS app’s push notification provider. Note that APNs support is a premium feature in DreamFactory’s Silver and Gold products, not an open source feature.

APNs is a native DreamFactory service that supports role-service-access, live API documentation, script access, etc. Once you’ve configured APNs in DreamFactory, all the configuration details are hidden from your client. They are securely stored in your DreamFactory instance database. This provides a simple way for your iOS application to send push notifications with DreamFactory.

Configuring an APN service is as easy as configuring any other services in the DreamFactory admin console. Start by logging into the admin console, head over to the ‘Services’ tab, and click on the ‘Create’ button on the left sidebar. Use the ‘Service Type’ drop down to select ‘Notification’ -> ‘Apple Push Notification’, complete the service configuration form and save it to create your service. 

In the ‘Info’ tab, provide basic service information – Name, Label, and Description.

apn-config-one.png

Then in the ‘Config’ tab, provide the following configuration information:

  • Certificate – String. Required. Provide your iOS APNs certificate (.pem) file. If you have the pkcs12 (.p12) file from Apple keychain access, you can convert it to .pem file using the following command.

openssl pkcs12 -in my-certificate-file.p12 -out my-certificate-file.pem -nodes -clcerts

Replace my-certificate-file.p12 with the name of the certificate file you exported from Keychain Access.

  • Passphrase – String. Optional. If your certificate requires a Passphrase then enter it here.
  • EnvironmentString. Required. Select your iOS application environment – Development or Production.
  • Service Event – Array. Optional. Here you can tie this APN service to any number of system events. In the example below we have tied our APN service with two events – “system.admin.session.post” and “system.admin.session.delete”. These events are fired respectively when a system admin logs in and logs out of the DreamFactory. It automatically fires this APN service and sends a push notification to targeted devices. You can enter the push notification message in the Message field.
apn-config-two.png

apn-config-three.png

Once you’ve configured your APNs service, head over to the ‘API Docs’ tab and expand your newly created service to see the API endpoints that are ready to use. You can learn more about these endpoints in the DreamFactory docs.

apn-api-docs.png


In this post, we quickly covered how simple it is to use DreamFactory to manage and send iOS push notifications with the Apple Push Notification Service. Head on over to the community forum to discuss or let us know what you think in the comments!