This post is a quick demo of Logic Apps that includes integration of Facebook to Twitter and Dropbox.
Every time a new post is posted on user’s Facebook timeline, this workflow will tweet the same post in User’s Twitter Timeline and same will also be delivered in to a Dropbox folder.
Logic apps can trigger based on a variety of data sources and offer connectors to get and process data as a part of the flow. I have referred the App Service Documentation for this demo which can be found here.
To do this demo all you need is
- An Azure subscription – Learn here how to sign up for a free Microsoft Azure account.
- A Facebook. Twitter and Dropbox account.
The first step would be to create the following 3 connectors
- Facebook connector – Facebook Connector lets you retrieve “New Post on User Timeline”, “New Post on Page”, “Publish Post”, “Publish Photo” and so on from your Facebook account.
- Twitter connector – Twitter Connector lets you post tweets and get tweets from your timeline, friends, and followers from your Twitter account.
- Dropbox connector – Dropbox Connector allows you to upload or download files from your Dropbox account.
Getting your connectors
1. To create a connector you need to open the Azure Marketplace in Azure portal. So click on Marketplace on the home screen as shown below.
2. Select API Apps and then search the connector one by one and create them.
3. To create the connectors you need to create the following
- App Service Plan – Create new App Service Plan
- Resource Group – Resource groups act as containers for your apps. All of the resources for your app will live in the same resource group.
Starting the Logic app
1. Click on the + New button at the bottom-left of the screen, expand Web + Mobile, then click Logic App. This displays the Create logic app blade, where you provide some basic settings to get started.
2. In Name type a meaningful name for your logic app.
3. Choose the App service plan you used when creating your connectors. This should automatically choose the Location, Subscription and Resource Group for you.
4. Once you hit the create button the logic app will be created on the home screen.
5. Once you click on the Logic app you have created you will get the following screen.
6. So now you need to click on the Triggers and actions link, which will open the design canvas. On the right hand side you’ll see the connector API app we just created earlier.
Adding a Facebook trigger
1. Triggers are what make your logic app run. Here we will use Facebook connector as a trigger/action for the Logic App.
2. You can drop the Facebook Connector API app into the editor by clicking on the “Facebook Connector” under “Recently used” from the gallery on your right hand side. Click on the Authorize button. Provide your Facebook credentials.
3. Select a trigger.
4. Click on “New Post on User Timeline” and choose a recurrence Frequency and Interval (such as once every 1 minute), then click the green check mark.
Adding a Twitter action
1. In the right-hand pane, find Twitter connector, then click it. After it has loaded, click the Authorize button, sign in to your Twitter account and click Authorize app. This grants the connector access to your Twitter account. A list of possible operations provided by the Twitter connector is displayed.
2. Click on Tweet. And then select action as “New Post on User Timeline Message Text”, then click the green check mark.
3. The Twitter connector is now part of the workflow. Now whenever a new post is posted on User’s Facebook timeline, the same post will be Tweeted in User’s Twitter Timeline.
Adding a Dropbox action and create the app
1. The final step is to add an action that uploads a Facebook post to a Dropbox file. In the right-hand pane, click Dropbox connector. After provisioning is complete, click the Authorize button, sign in to your Dropbox account, and Allow.
2. This grants the connector access to your Dropbox account. A list of possible operations provided by the Dropbox connector is displayed.
3. Click Upload file. This displays the Dropbox connector settings, which you must set to pass the message text from the Facebook to Dropbox.
4. In the FilePath field, type /tweet.txt
5. In the Content field, click the … button and click “New Post on User Timeline Message Text” option. This enters the value @triggers().outputs.body.post into the textbox.
7. Now that the design is complete, click Code view at the top left of the designer, and notice that this is the JSON code that defines the workflow you just created in the designer.
8. Click on Save button at the top left of the designer. This creates the new logic app.
Managing your logic app after creation
Now your logic app is up and running. Every time a new post is posted on user’s Facebook timeline the same post will be Tweeted in User’s Twitter Timeline and also delivered in to a Dropbox folder.
Finally, you’ll see how to disable the app, or see how it’s doing.
1. Click on Browse at the left side of the screen and select Logic Apps.
2. Click the new logic app that you just created to see current status and general information.
3. To edit your new logic app, click Triggers and Actions.
4. To turn off the app, click Disable in the command bar.