{tocify} $title={Table of Contents}
In the last step provide the name of channel. And we are ready to use it.
Once connected to the workspace, Configure Post message slack action
As can be seen in above image, message reached to Slack channel which was sent by Logic App.
Select Incoming webhooks and against Activate Incoming Webhooks - ON it
Followed by Http action, with method as POST, configure slack webhook url against URI and against Body -
Introduction
In most of the interfaces there is a need send some alert message to stake holders notifying about some errors or about some specific conditions.
Recently, in one of the interface the ask was to send alert messages(warning/issue/errors) to a slack channel where the business users were able to get notified instantly.
What is Slack Channel?
Slack is a messaging app for business that connects people to the information they need. (On same line as Microsoft Teams)
And Slack channel is a dedicated space for conversations that can be created for any project, topic, or team
So how do we integrate Logic app with Slack channel? Is there a out of box connector available for Slack?
Ways to connect to Slack channel
There are couple of ways to go about it,
1. Using connector
Yes, there is a connector provided by Microsoft to connect to Slack.
Before we use connector, let's first create a workspace in Slack. Go to slack (https://slack.com/intl/en-in/get-started#/createnew)
Enter your email address and continue. Provide the code received over email and continue.
On the first step, provide the name of your workspace
Provide your name and photo(optional)
Add team members in the workspace
In the last step provide the name of channel. And we are ready to use it.
We will post message to this channel from Logic app using the slack connector
Let's create logic app
Create logic app, provide name, region and select plan type.
For the sake of demo, creating a simple logic app which will be triggered by http request and will post to slack (same message received over http trigger).
Add new action and search for Slack. Select Post message (V2) from Actions
The screen will ask you to Sign in , click on it
Click on Allow to permit Logic App to interact with Slack workspace
select the Channel name(demoproject) where you want to post messages and provide value against Message Text(body of http request)
Save the workflow and that's it, ready for testing.
Now run the logic app, with some data . And check the slack channel if message is reached.
2. Using Http action (calling slack channel webhook)
Another option is to use http action in logic app and interact with slack channel, but for that we need to create an App in slack and webhook on top of slack channel.
Go to https://api.slack.com/apps
Click on Create an App to create slack workspace app
create an app from scratch
Provide name for App and select workspace for which you want to create app
App is created, Select Incoming webhooks
Click on Add New Webhook to Workspace
Grant permission to the App ,select the channel for which you want webhook to be created.
Copy the webhook url and use it in Logic app to post messages
We will post message to this channel from Logic app over the webhook url
Let's create logic app
For the sake of demo, creating a simple logic app which will be triggered by http request and will post to slack channel over the webhook (same message received over http trigger).
Followed by Http action, with method as POST, configure slack webhook url against URI and against Body -
{
"text": "@{triggerBody()}"
}
So whatever is received over http request is pushed to slack channel.
Note: using text is mandatory and payload should be valid JSON, else it will not be accepted.
Save the logic app and test it.
It is because we had created the webhook for channel through this App, and the url generated is associated to this App.
Summary
We saw that we have two options to post messages to slack channel and off course this will raise a question - which one to use?
What I observed is that - with slack connector you have to manually authorize every time you deploy the logic app to another environment .
And that is not required in case of webhook url, as the auth code is already part of the URL .
So, my preferred option is go with Webhook way !!!
Learn More about Logic App
- How to configure Logic App Standard workflow behind Azure APIM
- How to Query Azure Table storage from Logic App | How to filter results of Azure Table storage from Logic App
- Understanding expressions in Logic Apps | Frequently used expressions in Logic Apps | What is expressions in Logic App
- How to use Logic app Run History | How to troubleshoot Logic App workflow execution
- Logic App and Slack - Sending messages to slack channel | Logic app and slack integration | Connecting Logic App to Slack channel
- How to access Application settings fields value from Logic app Standard workflow | Using Application settings as configuration store for Logic app standard workflow
- Developing Logic app standard workflow which uses Map locally and deploying to Azure
- Developing Logic App Standard Workflow Using Visual Studio Code | Create Logic App Standard Workflow Using Visual Studio Code
- Logic App - Xml to Json using Liquid Map | Append in Liquid Map
- How to use Azure Event Grid Custom Topic | Publishing and Subscribing from Azure Event Grid Custom Topic using Logic App
- Using Azure Storage Account Table as Config Store for Logic Apps | How to read and write from Logic App to Azure Storage Account Table
- Get Logic App Name in Logic App
- Difference between Logic App Consumption and Logic App Standard
- Getting Started with Logic App Standard | Overview of Logic App Standard | Basics of Logic App Standard
- How to find count of Logic App executions using Azure Portal
- Azure Functions vs Azure Logic App | Difference between Azure Functions and Azure Logic App
- Getting started with Logic App : Liquid Map | Using Liquid template in Logic app
- How to get actual error message of Scope in Logic App | Exception Handling in Logic app
- Interview questions and answers on Logic Apps | Interview questions for azure logic app developers
- How to execute Stored Procedure in Logic App | How to connect to SQL in Logic App
- How to get current date in logic app | How to format date time in Logic App
- BizTalk Developer getting started with Logic App
- Getting Started with Logic Apps - Fundamentals
- Getting Started with Logic Apps - Enterprise Application Integration
- Getting Started with Logic Apps - AS2
- Getting Started with Logic Apps - EDI X12 Fundamentals
- Getting Started with Logic Apps - XML to EDI X12
- Getting Started with Logic Apps - EDI X12 to XML
- Getting Started with Logic Apps - What happened to the Request?
- Inserting Multiple Records In On Prem SQL Using Logic App
- Inserting data in On Premises SQL Database using Logic Apps
- Installing and Configuring On Premises Data Gateway - By adding user to Active Directory
- XML Batching(Aggregation) in Logic App
- Batching(Aggregating) messages in Logic App
- Debatching(Splitting) JSON Message in Logic Apps - ForEach and SplitOn
- Debatching(Splitting) XML Message in Logic Apps - ForEach and SplitOn
- Securing Logic App with Azure Active Directory authentication
- Removing ns0: prefix from xml output from BizTalk/Logic app XSLT map
- Using Managed Identity in Logic Apps for Calling Active Directory Secured Function App
- Logic Apps : Fetching ISA and GS Segment Values From Interchange Envelope and Mapping
- Logic Apps : For Each Inside a For Each - Fetching values from field in an array inside an array
Very well drafted article, it opens minds to many new possible scenarios. Will explore if similar things can be achieved via teams. Thanks for writing this and many others blogs, they are always very helpful and delight to read through.
ReplyDelete