The Slack connector provides 2-way integration between the Slack messaging system and others in Mule ESB.
Slack is a cloud-based product which enables real time messaging, archiving, search, and more (like a chat and messenger app).
Mule ESB is an integration framework from MuleSoft which has both a service container and mediation framework, developed on the Java platform and not limited to point-to-point integration.
Here I will showcase message streaming from Slack using their API in Mule ESB.
I will use Mule ESB 3.8, Anypoint Studio 6.0, and Slack Connector 3.5.
The Slack connector needs to be installed separately from the Studio. Please follow the below instructions to do the installation.
- Click on Help-> InstallNewSoftware.
- Select the repository for the connectors.
Select the Slack connector, follow the instructions, and install it.
Restart Anypoint Studio to reflect the changes.
You will be able to see the Slack connector symbol in the Mule palette.
First, create a flow element and drag the Slack component into the flow.
Configure the Slack connector configuration, using the token configuration in the below example.
Mule provides integration using a token or OAuth (please refer to the slack API guide for more information on generating an API token).
Configure the operation need in the Slack connector (in this example, we are retrieving the message from Slack).
Read the message from Slack and display it in the logger. To do that, drag and drop the logger component in the flow.
Note: Sometimes you will get an error during deployment saying that the Slack connector schema does not exist. The solution is to add the Slack connector jar in the build path.
Tip: You can build your own conversation bot using Slack, API.AI for NLP processing, and this can be achieved in Mule using the HTTP connector and Mule object store. Integration is the backbone and Mule connectors can help you.