Author: Shubham Singh Panwar and Ashish Singh Chauhan
What is Slack Event API?
With the Slack Events API, developers can create apps that respond to specific events in Slack, such as sending a message in response to a certain keyword or triggering a notification when a user joins a channel. This API allows developers to create interactive, real-time experiences for Slack users without having to constantly poll the Slack API for updates.
Prerequisites for Integration in Mule:
- Anypoint Platform Account. MuleSoft provides a 30 Days free trial account.
- Active Slack account. You can create a free trial account here → ps://slack.com/intl/en-in/pricing/free
Workspace creation steps in Slack:
- Click on try for free → Login with the email which you want to use → Enter the verification code.

- Select Create a Workspace → Enter Company name → Enter name → Skip next step → Enter some value in the team currently working on the field → Done.

Creating a Slack App and Enable Events Subscription:
- Create a dummy Mule application and deploy it into CloudHub. You will require its URL in the coming steps.


- In the browser go to api.slack.com → Create an app → Select from Scratch → Give the app name and Workspace (which you created in the previous step) → Done.

- In the Left corner → Event Subscription → Enable Events (Turn it ON).

- Add the URL for the application which you deployed in step 1 → Scroll down to Subscribe to Bot events → Add Bot user event → From the drop down list select “reaction-added” → Done.

- Now select “Subscribe to events on behalf of users” → Add Workspace Event → select “reaction_added” → done → save all changes.

- In the left corner → Oauth and permissions → click Install to your Workspace → click Allow.

- Check your Workspace → Your app is visible in the apps section.

Verification of working in CloudHub:
- Post a message in your Slack Workspace → Add a reaction to the message → Check the CloudHub logs.

- React to the message with any emoji (In my case I am reacting with eyes emoji).

- In CloudHub you will get logs like →

References:
1) Slack Event API: https://api.slack.com/apis/connections/events-api