Integrate Anaplan with Siri and iOS shortcuts
We now live in a connected world, and Anaplan provides us with Connected Planning—but what about extending that connectivity even further? Every day, we carry mobile phones in our pockets that are amazing in the possibilities they offer to our lives. Anaplan has a great mobile app so that you can review your dashboards and input forecasts from wherever you are, but how about extending that connectivity to exact times, your location, or even running Anaplan via your voice?
Apple has an awesome app that will be installed by default on your iPhone/iPad called Shortcuts. With Shortcuts, you can create powerful "If-Then Do" logic that can either be automated or run manually. A common example would be to create a Shortcut to automatically switch the lights on when you arrive home at night. I was thinking to myself recently it would be amazing to extend this ability across Anaplan.
Imagine creating a Shortcut that would:
- Run an Anaplan process at a specified time each day and then log the result to your Notes or Email
- Run an Anaplan process when you reached a specific location (i.e., your office)
- Log the status of your models each morning to a file on Dropbox
- Allow you to run an Anaplan Process by just asking Siri
So, I set about looking further into Shortcuts and found the secret sauce.
Anaplan has a very strong API having been designed for the cloud. You can review all the documentation here:
Having a strong API means that we can easily create POST and GET commands to interact with Anaplan.
Within iOS Shortcuts, there is then a command called "Get Contents of URL" that allows you to execute the POST/GET, etc.
Let's walk through an example of how to build:
- A Shortcut that authenticates with Anaplan
- Retrieves the processes within a workspace/model
- Executes a process
- is then automated at any time or location
|In this screenshot, you can see I have a number of Shortcuts. Some were downloaded from the galley and some were developed from scratch by me.|
Let's start with how I built the "Anaplan Processes" Shortcut to return the processes within a model, as I need the ID of a process in order to run it.
In order to authenticate with Anaplan, I did the following:
N.B. Authentication here is based on basic authentication and will then need to be amended every three months with the new password. Using a certificate would help to make this auth process more secure and less prone to code amendments.
Now that we have the authentication in place, we can run a request to get a list of processes within a workspace/model. We need this as a way to find the ID of the Process we want to execute anyway. In order to get a list of Processes we:
You will now be able to run this shortcut by pressing the play button in the bottom right. On finish, you should see a successful JSON return message consisting of all the Processes, their names, and their IDs. Make note of the ID of the Process you want to execute. If you need to debug your shortcut you can add Show Notification commands or even create an IOS Note of outputs to analyze.
Let's leave this Shortcut in place working and copy it, so we can reuse the majority of the Shortcut but edit it slightly to execute Process instead of listing Processes. To copy a shortcut, just hold your finger down on the shortcut until a menu appears and select Duplicate.
The edits required on the shortcut to execute a process are:
N.B. The way the IDs are retrieved currently means that if IDs change you update the URLs called by their codes. A way to address that point would be to add a step that will look for all IDs based on the name, using the endpoint "/models".
Now you have a working shortcut, you can execute it at any time by just pressing the shortcut. If you want to automate it though, you go onto the next screen, "Automation." Here you can create new automation from the + menu item and select "Create Personal Automation" with an Event "Time of Day" and a Do of Run Shortcut and then just select your shortcut. You can change the timing to be any day/time or even sunrise/sunset.
The shortcut could be enhanced further by retrieving the outcome of the process (Did it fail? How many records are rejected?) and then notifying the user of the outcome of the process.
Now you have created automation with Anaplan. Imagine now extending it to run an Anaplan process based upon your geolocation, arriving at your office, a change in the weather, or maybe a change in the exchange rate. Of course, the coolest thing now is you can execute the Anaplan Process just by talking. Just say "Hey Siri, run the shortcut Anaplan Run Process". That will certainly surprise people in your next meeting.