DEV Community

Alex Pliutau
Alex Pliutau

Posted on

Slack Stranger Bot in Go

wizeline-random

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 type Hi again to start a new random one.

Here is an example of how it works at Wizeline:

alex.pliutau [10:29 PM]

hi

Random WizelinerAPP [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

Random WizelinerAPP [10:31 PM]

wat

hahaha

alex.pliutau [10:31 PM]

bye

Random WizelinerAPP [10:31 PM]

Bye! You finished conversation with the Stranger. Type hi again if you want to start a new random one.

Random WizelinerAPP [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 or raise an issue.

Original post in my Blog

Discussion (1)

Collapse
partha2000 profile image
Partha Prateem Patra

Wow a very innovative idea. I liked your approach to develop new projects in a hackathon like mindset. This way one will create a minimum viable product without going into too much derails.