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

April 27, 2023 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 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

  1. Go to Slack API, and click Create New App.
  2. Select From scratch.
  3. Set the app name and Workspace.
  4. Add Permissions feature for your App.
  5. Scroll down to Scopes/Bot Token Scopes, and click Add an OAuth Scope.
  6. Add chat:write permission to your App.
  7. Notice: we only need a chat:write permission in Bot Token Scopes.
  8. Scroll up to the top of the page, and click install to Workspace to install your app.
  9. Click allow to install the app.
  10. There will be a Bot User OAuth Token which will be used later.
  11. Now, Go to Basic Information.
  12. 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 Bot User OAuth Token.
  6. 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:

msg

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

  1. The first sentence 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. Click allow to reinstall the Welcome Bot App to your workspace. msg

Step 5: Test your connection

Now your app is installed successfully in your workspace. msg

Mention your App @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 a welcome message sent from the welcome bot. 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
Platform