Projects‎ > ‎



The goal was to create a Slackbot (using that could text-to-speech to the cleanspace on command.

Slack provides an API for automated agents (bots) and there are many ways to access the API as found here. I looked at several of the Python examples and settled on Slask as most appropriate for the job.  It is very simple, well organized and easily extendible without changing any of the existing code.


The hardware for the project is a stock Raspberry Pi model B with Raspbian.  It has an ethernet and a simple headphone jack for audio output.  The only other part required is an audio amplifier and speaker.


  1. Set up the Raspberry Pi
  2. Install Espeak
  3. Create the slackbot on (get the access token)
  4. Install slask bot
  5. Create speakbot plugin in plugins/
  6. Make it start and restart automatically with monit
  7. Enjoy!
"""!speak <text> will speak the text"""
import re
import subprocess

def speak(m) :

    print 'speak("%s")' % m['espeak', m])
    return 'Spoken!'

def on_message(msg, server):
    text = msg.get("text", "")
    match = re.findall(r"(!speak)\s*(.+)*", text)
    if not match: return

    msg = match[0][1]

    return speak(msg)

Launch Script:

cd /home/pi/slask-master


check process speakbot
        matching "speakbot"
        start program = "/usr/bin/nohup /bin/sh /home/pi/slask-master/ > /tmp/speakbot.out &"
        stop program = "/usr/bin/killall slask"

Johnathan Vail,
Jan 24, 2015, 6:59 PM