DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Microsoft Outlook Integration to Mulesoft With Oauth 2.0
  • Using OKTA as Client Provider in Mulesoft
  • SelfService HR Dashboards with Workday Extend and APIs
  • MuleSoft OAuth 2.0 Provider: Password Grant Type

Trending

  • Ujorm3: A New Lightweight ORM for JavaBeans and Records
  • The ORM Is Over: AI-Written SQL Is the New Data Access Layer
  • Introduction to Tactical DDD With Java: Steps to Build Semantic Code
  • DevOps Is Dead, Long Live Platform Engineering
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Mulesoft and Slack Integration Using OAuth

Mulesoft and Slack Integration Using OAuth

This tutorial explains the steps to integrate Slack and Mulesoft with Oauth 2 authentication so that you can post a message from Slack to Mulesoft.

By 
Ravneet Bhardwaj user avatar
Ravneet Bhardwaj
·
Jan. 10, 21 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
10.7K Views

Join the DZone community and get the full member experience.

Join For Free

The Mulesoft Slack Connector enables organizations to connect directly with the Slack API, permitting users access to the Slack functionality with seamless integration.  

The lack of documentation to configure OAuth authentication for Slack connector makes it difficult for developers to use the connector with this security configuration. This article will guide developers to perform seamless integration with OAuth security.

Prerequisite

Anypoint Studio 7.6 , Mule Runtime 4.3.0, Slack Account Workspace

Setup

In order to connect with Slack via Mulesoft, first, an app needs to created in https://api.slack.com/apps.

Click on Create an App, enter the App Name, and select your Development Slack Workspace from the dropdown.

Once the app is created, go under Basic Information and copy the Client ID and Client Secret. These will be used in the Mulesoft Slack connector configuration.

Go to OAuth & Permission and add a Bot Token Scope as per your requirement. For this tutorial, I am adding a chat:write scope, which is used for posting messages to Slack.

Once the scope is added click Install to Workspace:

Once Oauth Token is installed to workspace, log into your Slack account. You should see the newly created app in your workspace.

Open Anypoint Studio and add Slack Connector in the project. In this tutorial, I will be using the Chat - Post Message operation for demonstration. In the Slack Config, select OAuth 2 Connection and enter the Client ID and Client secret copied earlier to Consumer key and Consumer secret respectively.

Under outhCallbackConfig, enter the details as below. Here, Authorize path will initiate the OAuth dance and the Call URL will return the access token which will be saved in the object store. Also, copy the External callback url; this needs to be in the Slack app.

Run the application, go to the Slack app, and add the Redirect URL as below:

To initiate the OAuth dance, go to the browser and enter the authorize URL http://localhost:8081/authorize. The below pop up will appear; click on Allow. The token will be retuned and saved to the object store of you application automatically.

Open Postman and hit the POST request to your Mule application listener with any payload as below:


Congratulations! You have successfully posted a chat message from Mulesoft to Slack using OAuth 2 as shown above.

Slack (software) security authentication MuleSoft Integration app

Opinions expressed by DZone contributors are their own.

Related

  • Microsoft Outlook Integration to Mulesoft With Oauth 2.0
  • Using OKTA as Client Provider in Mulesoft
  • SelfService HR Dashboards with Workday Extend and APIs
  • MuleSoft OAuth 2.0 Provider: Password Grant Type

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook