Slack Stranger Bot in Go
I am enjoying writing programs in a short time, like in a Hackathon way. Here in Vietnam we don’t have Hackathons often, so yesterday I decided to make one for myself with a time limit in 3 hours. The goal was to build/deploy something that will work and people can try it. I decided to go with Bot for Slack (or another messenger in the future).
So I wrote this Stranger Bot to meet strangers in your Slack, explore new people. It’s anonymous and private, Bot doesn’t store any data.
How it works?
- The User opens a private conversation with Stranger Bot.
- Types
Hi
. - Stranger Bot finds random active user who doesn’t participate currently in Stranger conversation.
- Bot will forward all next messages sent by user to Bot to the Stranger user. Without mentioning who sent this message.
- Any user can type
Bye
to finish the conversation, and typeHi
again to start a new random one.
Here is an example of how it works at my company:
alex.pliutau [10:29 PM]
hi
Stranger Bot [10:29 PM]
Connecting to a random Stranger …
Stranger found! Say hello, and please be polite. Type “bye” to finish the conversation
hola!!
alex.pliutau [10:31 PM]
Nice, super private
So it will work to find random person to talk
Stranger Bot [10:31 PM]
wat
hahaha
alex.pliutau [10:31 PM]
bye
Stranger Bot [10:31 PM]
Bye! You finished conversation with the Stranger. Type hi again if you want to start a new random one.
Stranger Bot [10:31 PM]
Bye! You finished conversation with the Stranger. Type “hi” again if you want to start a new random one.
Try it
- Clone slack-stranger-bot
- Create App in Slack and copy
API Token
- Install Docker
- Run
docker build -t stranger . && docker run stranger -e SLACK_TOKEN=<token>
with a valid token
Contribute
All code is open sourced. Feel free to contribute.