For the longest time, I have wanted get notifications and FileMaker working.
Let me qualify that statement, for me.
Pushover and Push2fm both work a treat! They both deliver on what they promise the product does, and deliver it. Goal achieved. They both addressed a problem and solved it.
I, am, however, a, little, bit, obsessed, with – UI and UX. So the idea of having to install another app to make this work straight up didn’t resonate with me. And didn’t work with my clients.
I needed to conquer this. And to be honest, the thought using APIs to generate notifications was a little daunting, to say the least. I am just a FileMaker developer, that is what I do, I don’t know API’s, they’re futuristic and how do I enter find mode on them?
The curiosity killed the doubt I had about what I didn’t know and I thought, bugger it, I’ll give this a go. So 2 weeks ago I start stuffing around to see if I could get notifications to work with FileMaker. Below is a short summary of what I succeeded with.
The good news is, it can be done! The bad news is, there are some caveats you need to be aware of.
- This will not work with a FileMaker iOS SDK app. [Sorry, not sorry, not my fault #EULA]
This method can work with a website [Google Chrome, Mozilla Firefox or Apple Safari] or native apps [iOS, Android, Windows Phone 8.0 & 8.1, Amazon Fire, Mac OS X or Google Chrome Apps & Extentions]. Also, the FileMaker iOS SDK [or Go for that matter] can not get the Device UDID, post API calls with headers, or allow installation of other SDKs – of which all of these are needed for it to work.
- You need a way to talk to your FMS from your stand alone app. I have chosen RESTfm [RESTfm]
- You need a way to make an API call from FMS to the notification provider. I have chosen BaseElements Plugin [BaseElements]
My set up
- FileMaker Server 15, with PHP enabled
- BaseElements installed on FMS [BaseElements]
- RESTfm installed on web server, pointing to your FMS [RESTfm]
- Apple Developer account [Apple]
- OneSignal account [OneSignal]
- Postman for testing and creating the API calls [Postman]
Did I scare you? Don’t be. It’s really not that hard.
How It Works
In short, I have a native iOS app, it makes an API call (you could use FM PHP I guess?) to the FMS, which in turn runs a script and sends an API call to OneSignal, which in turn sends the notification to the desired device [devices, segment, filter – we’ll get to this later], yew!
Here’s an image show the basic flow.
A bit more detail for you detail lovers and persistent readers who haven’t checked out.
The iOS app sends and API call to FileMaker Server, this is done using RESTfm framework created by Goya. I really love this product and personally, I sponsor it, and so should you. [RESTfm]
I firmly believe API’s are a necessary part of moving forward in any coding language, so get learning API’s. Message!
The API POST received from the app creates a record, and runs a FM script [as I added the script name as a parameter – see video] on the server after the POST is complete. All this script does is send an API call to OneSignal [this is where BaseElements needs to be installed on the FMS, as the API call requires headers]. After all that [a total of 2 x API POSTs] I get a response from OneSignal, and the recipient[s] get a notification. Voila!
The iOS App + Certificates
No, I didn’t build it – however, I did build a prototype in FileMaker, make a Quicktime video of that and voiced it over, created all assets, developed the API calls [RESTfm] using Postman, documented them and sent it all off to our capable iOS developer, who built it, installed the OneSignal SDK and generated all the necessary certificates required. Enabling the notifications took around 15 mins, I kid you not. Now being a FileMaker developer, you’d be surprised at how much of the app logic you can provide, so the iOS developer just has to code it – most likely saving you some money.
The FM Box
This really is just a dumb data source, and for this experiment, that’s all it needed to be. All it does is run a few scripts so I can manipulate the data the way I want, and also control notifications how / when they fire. The UI is crap, as it doesn’t need to be anything special because the usage of the FM database is primarily as a data source for the iOS app, and an accompanying website.
The Notification Provider
As for OneSignal, Uber use them, enough said. Their API is really nice and easy to use. Plus, a benefit of using the OneSignal SDK in the app is the extra metrics that they capture such as country, usage, last login, os, device etc etc. These can be used when sending notifications [All users in AU that have been active in the last 7 days]. OneSignal recommends sending notifications from the server rather than the app, as does Apple, and that is the architecture I have implemented. It’s a lot easier to update 1 server script rather than X number of apps.
Here is a short video showing how it all works. I have not provided a demo file as it would be rendered useless due to needing an accompanying iOS app, Apple Developer account and OneSignal account.
I want this
Click here to get in touch with us, we’d be happy to help.