Part 4 of a four-part series. In this post, we are going to register a bot in Slack and connect to the endpoint in Node-RED.
- Part 1: Set up required apps and services.
- Part 2: Configure watsonx Assistant to process simple Q&A.
- Part 3: Create a simple flow on Node-RED and integrate with watsonx Assistant.
- Part 4: Configure Slack and Node-RED integration.
Step 1. Create an app (bot) on Slack
- Go to https://api.slack.com/apps.
- Click Create New App, and set the name and workspace to install.
Note: It requires an approval from the workspace admin.
Step 2. Add Slash command
- Once the app is created, go to Features > Slash Commands.
- Click Create New Command.
- Define the command detail and Save. Make sure your command does not overlap with an existing command. Then, Request URL is going to be: https://<your_node_red>/talk. This time, I’ve named the commands as follows:
- /talktest for starting the conversation
- /cleartest for clearing the current conversation
- Go to Basic Information and click Request to Install. Then, Save Changes. The request will go to the admin of the workspace and they need to approve it.
Step 3. Test the integration
Once the request is approved, we are all set. Let’s initiate the conversation by entering the command. The slash command can be executed anywhere on the workspace, and the responses are only visible to you.
- Enter the slash command and hit enter.
- In order to continue the conversation, enter the command before your input.
- In order to reset the conversation, execute the clear command.
What’s next?
Now, you know how we can create a chatbot using watsonx Assistant and Node-RED. This time we integrated with Slack, but you can connect to your own apps or any other service that can access the endpoint we created on Node-RED. We hope you got the idea and apply what we’ve done in this series. Here are some “next steps” you can consider.
- Node-RED visualizes the flow, but it is not suitable for production use. Switch to Node.js for better load balancing and precise controls.
- Integrate with other services, such as text-to-speech, tone analyzer and any other nodes you can import to your Node-RED.
If you encounter any technical difficulties with services on IBM Cloud, feel free to contact at the Support Center.
Disclaimer
IBM is not liable for any damages arising in contract, tort or otherwise from the use of or inability to use this post or any material contained within. All sample code is provided as-is and IBM does not support customization. Do not use the code in production.