This video looks at the quickest way to create Azure Logic Apps: from templates! Many scenarios are available as a starting point for your new Azure Logic Apps, and in this video you create a new Azure Logic App to monitor Twitter for a specific hashtag and then post the new tweets to a Slack channel being monitored by a social media team.
- [Instructor] The quickest way to get started with Azure Logic Apps is through templates. Templates allow you to have a quick start example, an example that you can customize and a wizard driven experience for creating your first logic app. Let's see how this works. Navigate to the Azure portal and quick on the plus sign. In the Azure Marketplace, search for Logic App, and select Logic App by Microsoft.
Click create, and provide the detail for the wizard. The first field is the name of the logic app, and I think for our example we'll take a template that connects Twitter to Slack. So, a common scenario is team that needs to monitor the social media interaction of customers and users, and so we will monitor Twitter for tweets with certain hashtags and notify our team in Slack by posting a message into a Slack channel. So this will be our Twitter monitor logic app.
Place this in a resource group. And the resource group, as you know, is a logical group of resources for security and for cost management purposes, we'll places ours in West US, and print to the dashboard. Now, printing it to the dashboard is just for my convenience, but you'll also be able to see while it's being created an animated icon, and then it'll open with a design canvas for our logic app once created.
So now that our logic app has been deployed, we're shown the logic app designer, and here you see a list of common templates or ways to get started with logic apps with pre-prepared examples. Now you can edit all of them, so I will scroll down to a pre-prepared template for connecting Twitter to Slack. Here we have it, on the far right, post to Slack if a new tweet matches with some hashtags. Click, and you'll notice this template requires two connections, we need to be able to connect to Twitter, so we will need to log in, and we need to connect to Slack, so again we will need to have a login.
Here is the two connections the template requires, I will log in to twitter, and I will click Authorize app to allow my logic app to access Twitter. Same for Slack, my login is already saved. And here you can see, I will click the Authorize button to authorize my logic app to access Slack on my behalf. So these are prerequisites, the template requires these connections to function, so now when I click continue, you'll see the design surface that shows the flow, so we have step one at the top and step two at the bottom with an arrow in the middle saying this will happen first, and then this will happen second.
The first step is in fact a trigger, so this will cause the logic app to be launched. So, when a new tweet appears, our logic app will run. We will filter the tweets of interest, to Azure logic apps, and then we will post a message to Slack, and we will post it to a channel I previously created called tweets. Now, at this stage, this is enough to save the template and actually have it work, have it function as intended.
But notice on the right-hand side there's a tab that showed up called add dynamic content. So when we had the trigger, so Twitter notification, Twitter caused us to launch the logic app, there was additional information provided. So this dynamic content, this content provided when the logic app was launched, is available throughout our workflow, and so here in the post message task, you can see here, is an edit option, for using default values with some additional dynamic content.
So here you see message text, this will be the message text posted to the Slack channel, and you see two blue icons, one that says tweet text, and another that says tweeted by. So when I scroll to the right here, notice on the dynamic content, here we have name, name of the Twitter user, the tweet text that you see used in our Slack message template. So here we have the tweet text provided by the trigger, and we can use that tweet text here in the message as constructed, and it says tweeted by.
Similarly, we find that in the dynamic content. So, this is something of significance as we go through our workflow, as we go through the various actions, we will gather information and we are actually able to publish that to other actions. I'll click save. Now that we've provided the minimum information, and we saved our logic app, close the designer, and notice, we have the resource view in the Azure portal. So, in the resource view, we can see there is still the logic app designer option, but in the overview, we can see a run history.
At this stage, the workflow is not run yet. Click refresh, and you'll notice it has skipped a run where there was no new information from Twitter. When I go to Twitter, I'll create a new tweet, with the appropriate hashtag, I'll tweet. And so now, our logic app, based on the default interval of three minutes, will notice that the tweet has appeared, and will then take the action of posting that tweet to the Slack channel.
You will need to wait three minutes, click refresh at the right time. Or, you can say Run rigger, and cause the workflow to kick off immediately. I'll click refresh, and we can see the run has successfully completed, so when we go over to Slack, I can see in the channel tweets, a new tweet has appeared, there's the text, and there is the name of the person who tweeted.
So, by using the Azure logic app templates, I was able to rapidly create a new Azure logic app, fill in the minimum of information, and have that task completed. In this case, the task was simply to connect Twitter to Slack, when certain tweets of interest appear they get posted into a Slack channel. This is a very common scenario where you just need to connect one system to another to provide information to users using one system, from another system. So you just saw how to make a really quick start with Azure logic apps by using templates, and then you can customize those templates by adding more logic or adding more steps.
- What is Azure Logic Apps?
- API connections: triggers and actions
- Composing a workflow
- Adding custom code with Azure Functions
- Security and monitoring