How to create a welcome bot to send custom greeting messages on Slack
Being a Slack community maintainer, the process of onboarding new members is helpful, but it can also be time-consuming.
Building an automated welcome bot is a good way to tackle this problem.
In this tutorial you’ll learn how to create a Slack app that sends a custom welcoming Direct Message to new members, similar to the one above, when new members join your channel.
The entire process can be completed in about 5 minutes, and you don’t need to write any codes.
Table of Contents
- Step 1: Create a Slack App
- Step 2: Build a connection in Vanus Cloud
- Step 3: Generate your custom welcome message
- Step 4: Connect with your Slack APP
- Step 5: Test your connection
Step 1: Create a Slack App
- Go to Slack API, and click Create New App.
- Select From scratch.
- Set the app name and Workspace.
- Add
Permissions
feature for your App. - Scroll down to
Scopes/Bot Token Scopes
, and clickAdd an OAuth Scope
. - Add
chat:write
permission to your App. - Notice: we only need a
chat:write
permission inBot Token Scopes
. - Scroll up to the top of the page, and click
install to Workspace
to install your app. - Click
allow
to install the app. - There will be a
Bot User OAuth Token
which will be used later. - Now, Go to Basic Information.
- Scroll down to App Credentials and copy the two following credentials.
- Verification Token
- Signing Secret
NOTE: Do not close this page, but open a new Tab to do Step 2.
Step 2: Build a connection in Vanus Cloud
- Log in to Vanus.ai.
- Choose the
custom greeting message in Slack
template. - Write a name for your connection.
- Copy and paste two credentials from Slack as configurations. Then click
Next
. - Go back to Slack App page to copy the
Bot User OAuth Token
. - Paste the
Bot User OAuth Token
to Slack Sink.
Step 3: Generate your custom welcome message
In Slack, a section is a way to visually organize information within a message. The current template contains all sections to build a following welcome message in Slack:
Here are some tips to help you generate a custom message.
- The first sentence can mention the user who just joined your channel. No needs to edit it.
Hey <$.data.new_user>!
- You can add any hyperlinks by the following format
{{text|URL}}
. Do not add any spaces in it.
{{Vanus Cloud|https://cloud.vanus.ai}}
-
You can add any Slack-supported emojis like
:cloud:
in your section. Emoji codes can be found by copying the emojis and paste them into text editors. -
Feel free to write multiple lines in a Section or write each line in different sections. You can even delete sections in this template.
-
Click the
Submit
button once you made your greeting messages.
Step 4: Connect with your Slack APP
- You should see a connection once you submitted. Click its name to see the detailed information.
- Click the
copy
icon to copy the webhook url. - Go back to your Slack APP page and click on
Event Subscriptions
in the side menu. Enable Events by turning on the switch. - Use the Webhook URL we just copied in Step 4.2 and paste it in Request URL. You should see a green Verified indicating our Source is verified by Slack.
- Scroll down, click Subscribe to bot events and after you will be able to click Add Bot User Event.
- Select
member_joined_channel
to receive events whenever a new member joins your Slack Channel. - Now, click
Save Changes
to complete your configuration. - You may receive a notification to reinstall your app to your workspace. Click it to reinstall your app.
- Click
allow
to reinstall the Welcome Bot App to your workspace.
Step 5: Test your connection
Now your app is installed successfully in your workspace.
Mention your App @Welcome Bot
to add it to the channel.
To test if our welcome bot is working, you can leave the channel and rejoin it.
- Right-click the channel and leave it.
- Click
Add channels
andBrowse channels
. - Rejoin your channel and you can see a welcome message sent from the welcome bot.
Conclusion
In this tutorial, we introduced how to build a welcome bot sending custom greeting messages when new members join your Slack channel.
You can find more interesting connection templates on Vanus cloud.
Feel free to ask any questions if you encounter problems in our Slack channel.