Skip to content

About

Python Flask Slack bot for APK QR code generation & multi-channel broadcast

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Slack QR Bot

Top Language slack-qr-bot License Docker Pulls GitHub Stars

A Slack bot that converts APK download URLs into QR codes and automatically sends them to Slack channels.


Features

QR Code Broadcast Custom QR API Key Auth Rate Limiting Swagger JSON Logging Helm Health Check

  • QR Code Generation — Single channel, multi-channel broadcast, broadcast-all, custom colors/size
  • Security — API key authentication, rate limiting per endpoint, structured JSON logging
  • Reliability — Automatic retry with exponential backoff (2s → 4s → 8s), detailed health checks
  • Developer Experience — Swagger UI at /api-docs, Helm chart, Helmfile, CI/CD automation

Quick Start

Docker

docker run -d --name slack-qr-bot \
  -p 8080:8080 \
  -e SLACK_BOT_TOKEN="xoxb-your-token" \
  -e API_KEY="your-api-key" \
  somaz940/slack-qr-bot:v0.3.0

From Source

make venv
export SLACK_BOT_TOKEN="xoxb-your-token"
make run

Helm

Recommended: OCI registry (Helm 3.8+)

helm install my-bot oci://ghcr.io/somaz94/charts/slack-qr-bot \
  --version 0.3.0 \
  -n slack-bots --create-namespace

Alternative: classic Helm repo

helm repo add slack-qr-bot https://somaz94.github.io/slack-qr-bot/helm-repo
helm repo update
helm install my-bot slack-qr-bot/slack-qr-bot -n slack-bots --create-namespace

See Deployment Guide for Kubernetes setup and Deploy Examples for Helmfile configuration.


API Usage

Interactive API docs available at /api-docs (Swagger UI). See API Reference for full details.

# Health check
curl http://localhost:8080/health

# Generate QR and send to Slack
curl -X POST http://localhost:8080/generate-qr \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -d '{"channel": "apk-qr-generator", "apk_url": "https://example.com/app.apk", "build_number": "1.0.0"}'

# Multi-channel broadcast
curl -X POST http://localhost:8080/generate-qr/broadcast \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -d '{"channels": ["channel1", "channel2"], "apk_url": "https://example.com/app.apk"}'

Configuration

Variable Required Default Description
SLACK_BOT_TOKEN Yes - Slack Bot OAuth Token (xoxb-...)
API_KEY No (none) API key for authentication
RATE_LIMIT_ENABLED No true Enable rate limiting
PORT No 8080 Server port

See Configuration Guide for API key setup, rate limiting details, logging, and CI/CD integration.


Architecture

src/                        # Flask application source
├── app.py                  # App factory + Swagger + rate limiter
├── config.py               # Configuration & logging setup
├── decorators.py           # API key authentication decorator
├── services.py             # Core QR/Slack integration logic
├── utils.py                # Response utilities
└── routes/                 # Flask blueprints
    ├── health.py           # GET /health
    ├── qr.py               # POST /generate-qr (+ broadcast, custom)
    ├── channels.py         # GET /channels
    └── slack_events.py     # POST /slack/events
tests/                      # Pytest test suite
deploy/                     # K8s manifests + Helmfile (see deploy/README.md)
helm/                       # Helm chart (6 templates + 2 examples)
hack/                       # Build/version scripts
k8s/                        # Secret templates
docs/                       # Documentation
.github/workflows/          # CI/CD (10 workflows)
CI/CD Pipeline (Jenkins/GitLab/GitHub)
    ↓ (HTTP POST with X-API-Key)
Ingress (slack-qr-bot.example.com)
    ↓
Service (slack-qr-bot:8080)
    ↓
Pod (Flask App)
    ├─ Rate Limiter (request limiting)
    ├─ API Key Auth (authentication)
    ├─ JSON Logger (structured logging)
    └─ Tenacity Retry (retry logic)
        ↓
Slack API (QR code upload)

Development

make build            # Create venv and install deps
make test             # Run tests with coverage
make lint             # Run flake8 linter
make docker-build     # Build Docker image
make docker-buildx    # Multi-arch build and push
make test-helm        # Validate Helm chart
make version          # Show version across all files
make help             # Show all available targets

Documentation

Document Description
API Reference All endpoints, request/response examples, status codes
Configuration Guide Environment variables, API key, rate limiting, logging, CI/CD
Deployment Guide Local dev, Docker, Kubernetes deployment
Deploy Examples Standalone K8s manifests, Helmfile configuration
Helm Chart Helm chart configuration reference
Slack App Setup OAuth scopes, bot token, channel setup
Testing Guide Unit tests, Helm tests, smoke tests
Version Guide Version management, bump process, release workflow
Troubleshooting Common errors and solutions

Tech Stack

  • Language: Python 3.14
  • Framework: Flask 3.x + Gunicorn
  • Libraries: slack-sdk, qrcode[pil], flasgger, flask-limiter, tenacity, python-json-logger
  • Infrastructure: Docker, Kubernetes, Helm, GitHub Actions

Contributing

Issues and pull requests are welcome.


License

This project is licensed under the Apache License 2.0.

About

Python Flask Slack bot for APK QR code generation & multi-channel broadcast

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages