Python Slack bot example running on Google App Engine and subscribing to Slack events via Events API.
This bot uses Slack Events API to subscribe to selected events and reply via Slack Web API.
This is a proof of concept Slack bot example, which:
- repeats every message in direct conversation or channels to which bot is invited,
- verifies all incoming Slack events with verification token,
- runs for free within GCP Free Tier if there is a small traffic,
- automatically scales for larger traffic (requires billing enabled).
- Create a GCP project in GCP Cloud Console - see docs for details,
- Create a Slack app on https://api.slack.com/apps/,
- Add a bot user for your app,
- Update bot access token and verification token in settings.py,
- Install gcloud tool,
- Deploy app using gcloud app deploy command, e.g.
gcloud app deploy --version v1 --project your-gcp-project-id app.yaml
- Visiting https://your-gcp-project-id.appspot.com page should trigger 'Hello World' message on #general channel. Slack Web API is now working!
- Subscribe to message.channels and message.im event types by providing
https://your-gcp-project-id.appspot.com/slack/event
url - see docs for details, - Your bot is now working! You can start chatting with him.
You can find all development setup in .travis.yml