Skip to content
This is a project of a slack bot, to automate your office using a raspberry pi
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information. Update Oct 17, 2017
slackbot-PAPER-PDF.pdf adding the article/paper written Sep 21, 2017 Final version Sep 17, 2017

Slack Bot with internet of things

This is a project of a slack bot, to automate your office/room/lab using some Raspberry Pi GPIO pins.

Usage: Youtube

Set up your slack workspace

Go to . First you'll need to create a new slack workspace to use in this project(or just get the API token from a existing bot in the workspace). Then, go to and choose a username for your bot.

After submit, we now have an API key. Copy this somewhere we'll need later.

api key example


Now, on your Pi you'll need to install some dependencies:

  • Python3
  • pip3
  • python3-rpi.gpio
sudo apt-get install  python3 python3-pip python3-dev python3-rpi.gpio -y

And then some packages:

  • slackclient
  • psutil
pip3 install slackclient
pip3 install psutil

And download the repository:

git clone

Configuring the python file

After downloading file there's some things you'll need to adapt to your bot, like your API token that we generated earlier.

slack_client = SlackClient("your-api-token-here")

In this next step, we fetch our bot User ID. We will use this later to know when somebody is talking to our bot. We keep it in slack_user_id.

user_list = slack_client.api_call("users.list")  
for user in user_list.get('members'):  
    if user.get('name') == "your-bot-name":
        slack_user_id = user.get('id')


Now you can personalize your bot with some GPIO pins(any doubts about GPIO pins go to RPI.GPIO Documentation):

from slackclient import SlackClient

And some methods:

def lightOn():
    GPIO.output(8, 1)
    print ("light on!")
def lightOff():
    GPIO.output(8, 0)
    print ("light off!")

And then link the methods you've created to the bot's matching text part.

if re.match(r'.*(light off).*', message_text, re.IGNORECASE):
//words you want your bot to recognize
	lightOff() //the gpio method to execute
	text="Light off!", //bot response

Now, run it!



Physical gpio setup example

This is an example configuration, of how you can use the GPIO pins to turn on a Led.

I'm using a Raspberry Pi B+ model 1 and the GPIO pins 6(Ground) and 8(GPIO). All the pins of this Raspberry that i'm using can be found in this picture: gpio-pin

Now a picture of the physical setup:

Raspberry Pi + relay board with a Led


More information about the relay board can be found on relay-board


Some useful links :)

Credits to :


You can’t perform that action at this time.