Overview
Recently at an internal conference, I got my hands on this pretty cool tiny button Flic, go read about it here. Apart from all the cool stuff you can do with Flic’s extensive support for integration, my interest was around how Flic can integrate with Microsoft Flow. However, I wanted to share some clarify on how can you do this and things that Flic could do better to make this integration experience better.
What I have blogged here is to simply capture each click, double click and hold events from the Flic button, trigger Microsoft Flow from the Flic mobile app. From the Microsoft Flow, capture each of these events, log the trigger message as an Azure Queue message.
Once the message got in to the Azure world, you have many opportunities, such as to pick up the incoming message by integrating using many of the Azure event driven models such as ….
Setting Up your Flic
I am assuming you have your one or more Flic buttons. Go ahead and setup your Flic. This is very simple and straight forward step following guidance from the Flic.io site.
As I was setting up my single Flic I had on my iOS app (Equally applies to Android as well), I named my flic like below. So make sure to give unique name for each of your Flics.
Microsoft Flow App Install and Setup
On your mobile device, ensure to install the Microsoft Flow app from your app store. Once the Flow app is installed, ensure you login to the Flow app with your account that is same as your Azure account. The email account for the Flow app and the above Flic app doesn't need to be the same, but just remember which email you are using in each app to ensure the connectivity between each app.
Setting Up Flic to do Flow tasks
Now lets set up your Flic to call the Flow. So click on your Flic from the mobile app (Not the physical Flic button). For each event Click, Double Click and the Hold, assign Microsoft Flow from the Advanced category and your assignment would look like below. (What can Flic do better is allow this trigger integration to be named as this will get listed as simply Flic in the Microsoft Flow later) .
Azure Queue
From your Azure account, login to the Azure portal and create a generic storage account and you can dedicate a separate Resource Group.
From this storage account, under the Queue, create a new Queue and I assigned name such as single-clicks assuming I would only write a single click events to this queue.
Likewise I have created separate queue for each type of event: double-click and hold.
Building Microsoft Flow
Now run the Microsoft Flow from the Mobile or browse to the flow.microsoft.com on PC as you can build the App from either place with same consistent interface. Below I will show from the mobile for simplicity.
Form your Microsoft Flow app, choose to create new Flow and then search for ‘flic’ and you will see two below triggers. Choose When a Flic is pressed
Choose any, this is just to establish the body of the incoming message from the Flic.
Next add Parse JSON action to parse the incoming message as JSON object and add the body as Content. Next add same payload as {“body”:”text”} to auto generate the schema.
Next lets add a Switch so that we can handle each click type and write to respective Azure queues:
Next choose to Click type as On Switch condition.
Choose action as Put message to queue
Choose single-click queue to write the single click event message.
Likewise add additional switch cases to write for double-click event to double-click queue and hold event to to hold queue.
Now lets save the Flow and test the process with following clicks and observer the corresponding queue in the azure.
click
double click
hold
If you do not see expected message, then check to ensure your flow is working properly.
1 comment:
Can you please help me? I do not see Flow option under Advanced in my Flic app. Is it because I am using Virtual Flic right now.
Post a Comment