DEV Community

Derrick Sherrill for WayScript

Posted on

Build a Customer Help Bot for Slack with WayScript

Introduction

Bots today are an essential part of Customer help services. With services used by millions of people, it’s difficult for Customer service people to handle all the problems addressed to them. Bots can be easily built and integrated into any services if you are using the Wayscript Platform. So today, we are going to build a Customer help Bot for Slack.

Prerequisites

No prerequisites for this tutorial. However, you can read about the module we are going to use in this post.

Slack Trigger

When someone writes a message in the help channel, we’ll capture the message and perform actions on it, and later send a response. For this purpose, we’ll use the Slack Trigger.

Adding Slack Trigger

Well, The trigger will depend on the action I add on the Slack channel. It’s a pinned message.

Image of actions

So basically we have three actions. But first, we have to configure the Trigger.

We want to receive actions in A, B or C.

Image of the configuration

For the output, be sure to have Slack_Message_Text selected. This variable contains the message the user sent.

Java Module

WayScript allows you to write programs with Python, JavaScript, or Java if you want to perform more complex tasks. Here we’ll work with Java.

Add it as a new module.

Adding the module

Once it’s done, click on Edit Code. We will write a script to perform actions on the Slack message we’ve received.

Java Code

Here nothing complex. I used Switch expression for more visibility and simplicity. By default, if we have no valid option, we’ll just ask the user to provide the right message.

Click on Done Editing when finished. We’ll move the Slack Bot and configure it.

Slack Bot

Wayscript provides a Slack module you can use to read or write messages. Then, we can use this module to create the Slack Help Bot.

Adding the module

Once it’s added and you have configured the workspace, be sure to have a separate channel for this bot. In my case, I called it help.

Configuration of Slack Bot

Now, we can add inputs. Most importantly, we need the name of the Bot and the message. You can add an image to if you want to give a face to your Bot. ;)

Slack inputs

Great! The Bot is ready, and if you’ve followed exactly this tutorial, your result will look like this.

Right message

Wrong message

Conclusion

Questions about this script or anything else? Join our Discord. We're always around to help. If you want to work with the full script template, just find it here.

Top comments (0)