This simple script written in basic Python will allow you to hook into the real time API of Slack and perform a direct message greeting to every new joiner! Usually this is used to tell new joiners about the network, the guidelines, rules, useful links etc etc
New to programming or don't know how to get started just yet? Don't fret! @izzydoesizzy wrote an amazing step by step, tutorial with screenshot
If you like this project and you use it for your community or anything else, please hit the STAR button ⭐️ on the top right side so I know you dig it! It makes me feel appreciated and it's free.
If you have questions open an Issue
(preferred) or reply to the tutorial article
Python 2.7+.
Edit bot.py
on lines 26-28 to customise with your greeting and token
git clone https://github.com/orliesaurus/greetingslack.git
cd greetingslack
virtualenv greetingslack
python -m venv greetingslack
. greetingslack/bin/activate
pip install -r requirements.txt
python bot.py &
Deploy with a click supported now
🔥 DONT FORGET TO SCALE YOUR FREE DYNO
A1.
To change the welcome message, edit your Heroku variables:
Go to Heroku's Settings, then where it says Config Variables
click Reveal Config Vars
and it will reveal your message and other fields. This will restart your Heroku instance pretty quickly and apply the changes for you
A2. After setting up the bot, your welcome message will be displayed to every new user, as soon as a they join your Slack network - as a direct message. Check the example below:
A3.
In the environment variables set DEBUG_CHANNEL_ID to be the ID of your chosen debug channel. That's usually achieved by using export DEBUG_CHANNEL_ID=<YOUR SLACK CHANNEL ID>
in your CLI. We suggest to make this channel private so not just anyone can join it.
A4. You can tell your greeting bot to forward messages that users send to it to another channel.
- Generate an API Token for you slack workspace. Set the
SLACK_TOKEN
environment variable to the token.
export SLACK_TOKEN=<WORKSPACE API TOKEN>
Note: This is a different token then the one needed to configure the bot
2. Create a channel for the bot to post and add the bot to the channel
3. Get the channel id for the channel. Set the RESPONSE_CHANNEL
environment variable to this.
export RESPONSE_CHANNEL=<channel id>
After setting these variables, the bot will forward messages sent to it by copying the users real_name
and message content and posting in the RESPONSE_CHANNEL
.
Note: the real_name
is used since it is the only name field that always contains a name.