Skip to content

Instantly share code, notes, and snippets.

SLACK_KEY = 'myslackkey' # Your bot's Slack key
BOT_ID = 'mybotid' # Your bot's Slack ID
@Elleo
Elleo / step-1.py
Created January 10, 2018 16:25
The skeleton of a Slack bot which just responds with “Hello!” whenever a user sends it a message.
import sys, time
from slackclient import SlackClient
SLACK_KEY = 'myslackkey' # Your bot's Slack key
BOT_ID = 'mybotid' # Your bot's Slack ID
READ_WEBSOCKET_DELAY = 1 # Delay in seconds between reading from firehose
def handle_question(question, channel, bot, slack_client):
slack_client.api_call("chat.postMessage", channel=channel,
text="Hello!", as_user=True)