Integrating Slack with Mule APIs: A Step-by-Step Guide

Overview

In any Mulesoft Project, There are lot of tasks that are performed manually and repeatedly. A best example is the on boarding new joiners to the Anypoint Platform, where the operations person will have to login to the Anypoint platform and manually on board/invite every person to the platform from Access Management tab. Along with Anypoint platform On boarding, the person has to be on boarded to the catalyst portal as well.

My Solution primarily aims to solve this problem with the help of a MuleSoft API Led, Slack bot based solution which automates the on boarding of folks to Anypoint platform and catalyst portal by simple commands that can be executed over the slack bot channel and send one automated mail, with steps to proceed with login to Catalyst and a sheet having useful catalyst links specific to Mule Project Life Cycle. This ensures quicker on boarding of resources and saves time for the folks on the operations team who can focus on more critical tasks. The second part of the solution automates some of the routine tasks performed by the platform support team like performing UPDATE,START,STOP,RESTART & DELETE operations to a Mule application.

How this Solution will help overcoming above problems of manual efforts?

I come up with a Slack chat bot solution which will do below mentioned things:

  • Send a invite to a resource by just passing the role and email address along with the command which will then:
    • Send a platform invite by granting the access of Platform and Catalyst.
    • Send one automated mail, with steps to proceed with login to Catalyst and a sheet having useful catalyst links specific to Mule Project Life Cycle.
  • Perform UPDATE,START,STOP,RESTART & DELETE operations to an application by just passing the specific action along with application name.
How this Chat bot will work in terms of API-LED architecture?

Below is an architectural diagram of how’s the communication flow happened between Slack and Platform, based on API-LED approach:

Architectural Diagram of how the communication happens between Slack and Mule APIs.

How to get started with this cool solution?

Our Slack Bot solution works by executing some predefined commands, which will then communicate to the exp api. This exp api based on the command operations will communicate to downstream apis. In my next post on this, I’ll explain how to integrate slack with existing Mule APIs to perform certain operations which will give you the full insights of this solution. For now, below are the commands which can be executed on slack to perform certain operations

CommandParametersOperations
/loginusername, passwordWill get you an access token.
/organizationsaccess tokenWill get you an org details.
/invitesroleId, roleName, access token, emailAddressWill help you to send platform invite to the user based on the email provided.
/applicationaccess token, action, appNameWill help you to perform different operations like UPDATE, START, STOP, RESTART & DELETE on a particular application.

In the next post, I’ll explain step by step integration of slack with Mule APIs which will demonstrate how to perform certain operations on Anypoint Platform. With the coming post you’ll get the full insights of this solution. Stay tuned.

In case if you want to know how to start with implementing Mule APIs you can visit getting started with anypoint studio.