Ever felt a need to be reminded of some randomly chosen custom message regularly as an Android or iOS push notification? Well, just use Salesforce.
SalesforcePushNotifier is a lightweight apex based metadata to fire random personalized messages at regular intervals through REST requests to a third party Android/iOS app which displays the said messages as notifications on your phone.
I was upskilling myself and gathered some good pace and went through quite a lot of new concepts. Unfortunately, I forgot how to apply most of them in about a week. Thus, I wanted to note down some points and be reminded of them regularly. If I could only think of a place where I go regularly to see these reminders. My phone of course!
I searched for many apps which would allow me to get my messages as notifications, fortunately I found many android apps using REST API to show up messages as notifications but unfortunately that was about all they did. So I decided to write my own code, after all, the only thing it needed was to fire HTTP requests at random.
Maybe you might have a different use case. Maybe you want to be notified of personal stock market info. Maybe you want inspirational quotes sent to you. Your message, your needs.
Being a Salesforce developer myself(not a good one :frowning_face:), I had everything I needed:
I have used an android app called Alertzy, installed on my phone with a personal API key to display the notifications on my phone. There are several such apps and you can choose any of them.
The messages are stored in the Salesforce “Quick Text” standard object. I found the existing standard fields to cover most of my functionality, although you could add custom fields as per your liking.
The API Key is stored in a hierarchical custom setting. This identifies a device to send push notification. If you are using multiple devices, you may change this to a list custom setting.
Named credentials are so important and powerful when working with callouts. No more of the remote site setting stuff.
I have used a cron expression to schedule the callout for every 15 minutes of every day. It is in the .apex class. You may change it to your liking.
I can think of some improvements to make which will be coming shortly. Also I’ll be bundling this up in a 2nd Generation Unlocked package soon.