How to create a welcome bot to send custom greeting messages on Slack

April 27, 2024 4 min read
Jay Ding
blog image

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.

msg

In this tutorial you’ll learn how to create a Slack app that sends a custom welcome message, 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

  1. Go to Slack API, and click Create New App.
  2. Select From scratch.
  3. Set the app name and Workspace.
  4. Enable incoming webhooks feature for your App.
  5. Activate incoming webhooks.
  6. Add a new Webhook to your workspace.
  7. Choose the channel the bot can post to.
  8. Obtain the Webhook URL of your welcome bot.
  9. Go to Basic Information.
  10. 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

  1. Log in to Vanus.ai.
  2. Choose the custom greeting message in Slack template.
  3. Write a name for your connection.
  4. Copy and paste two credentials from Slack as configurations. Then click Next.
  5. Go back to Slack App page to copy the Webhook URL.
  6. Paste the Webhook URL to Vanus connection.

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:

msg

Here are some tips to help you generate a custom message.

  1. The first section can mention the user who just joined your channel. No needs to edit it.
Hey <$.data.new_user>!
  1. You can add any hyperlinks by the following format {{text|URL}}. Do not add any spaces in it.
{{Vanus Cloud|https://cloud.vanus.ai}}
  1. 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. msg

  2. Feel free to write multiple lines in a Section or write each line in different sections. You can even delete sections in this template.

  3. Click the Submit button once you made your greeting messages. msg

Step 4: Connect with your Slack APP

  1. You should see a connection once you submitted. Click its name to see the detailed information. msg
  2. Click the copy icon to copy the webhook url. msg
  3. Go back to your Slack APP page and click on Event Subscriptions in the side menu. Enable Events by turning on the switch. msg
  4. 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. msg
  5. Scroll down, click Subscribe to bot events and after you will be able to click Add Bot User Event. msg
  6. Select member_joined_channel to receive events whenever a new member joins your Slack Channel. msg
  7. Now, click Save Changes to complete your configuration. msg
  8. You may receive a notification to reinstall your app to your workspace. Click it to reinstall your app. msg
  9. In this example, I will reinstall it in the test channel. msg

Step 5: Test your connection

Now your app is installed successfully in the test channel. msg

Mention your bot @Welcome Bot to add it to the channel.

msg

To test if our welcome bot is working, you can leave the channel and rejoin it.

  1. Right-click the channel and leave it. msg
  2. Click Add channels and Browse channels. msg
  3. Rejoin your channel and you can see the welcome message now. msg

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.

Vanus