Guides

Bot development guides

338 guides written for builders. Read them in order for a complete course, or jump straight to your platform.

All guides

Basics

Getting started

What a bot is, how to pick a platform, polling versus webhooks, and the minimum production checklist.

Telegram

Telegram bots

Create a bot with BotFather, handle updates with polling or webhooks, add inline keyboards and stay within limits.

Discord

Discord bots

Register an application, choose Gateway intents, ship slash commands and buttons, and verify HTTP interactions.

WhatsApp

WhatsApp Cloud API

Send and receive WhatsApp messages through Meta's official Cloud API with templates, webhooks and opt-in.

Slack

Slack bots

Create a Slack app with a manifest, choose scopes, receive events over HTTP or Socket Mode and verify requests.

AI

AI chatbots and agents

Add language models to a bot with tool calling, retrieval and MCP while controlling cost, latency and prompt injection.

Automation

Automation workflows

Design trigger and action workflows, self-host n8n, handle errors and know when to move to code.

Webhooks

APIs and webhooks

Build webhook receivers that verify signatures, acknowledge fast, deduplicate and retry correctly.

Scraping

Web scraping ethics

When automated collection is acceptable, how to be a polite crawler, and the lines you should not cross.

Hosting

Hosting bots

Pick the right runtime for polling, Gateway and webhook bots, and run it with restarts, logs and backups.

Serverless

Bots on Cloudflare Workers

Deploy a webhook bot at the edge with secrets, storage, background work and scheduled jobs.

Security

Bot security

A threat model and checklist for bots: secret management, least privilege, signed webhooks, SSRF, injection and leaks.

Reliability

Reliability and rate limits

Keep a bot fast and correct under load: respect 429s, queue work, deduplicate, time out and alert.

Meta

Messenger and Instagram bots

Connect a bot to a Facebook Page or Instagram professional account through the Messenger Platform: webhooks, the 24-hour window and app review.

Community

Twitch, Reddit and X bots

Build community bots for Twitch chat, Reddit and X: authentication, EventSub, API access rules, rate limits and disclosure.

Matrix

Matrix bots

Write bots for the open, federated Matrix network: access tokens, /sync, sending events, encryption and when to use an appservice.

Voice

Voice bots

Design voice assistants and phone bots: the STT, LLM and TTS pipeline, streaming, turn-taking, latency targets and consent for recording.

AI

RAG chatbots

Ground bot answers in your own docs: chunking, embeddings, hybrid search, reranking, citations, permissions and evaluation.

AI

Function calling

Let an LLM call your APIs safely: write tool schemas, validate arguments, confirm side effects, handle errors and limit loops.

Quality

Testing bots

A test strategy for bots: pure handlers, recorded payloads, fake platform APIs, conversation scripts, contract checks and LLM evals.

DevOps

CI/CD for bots

Ship bot changes safely: CI checks, secret handling, staging bots, registering commands on deploy, webhook updates and fast rollback.

Data

Databases and state

Choose where bot state lives: in-memory, key-value, SQL or document stores; model sessions and flows; handle concurrency and retention.

i18n

Internationalization (i18n)

Make a bot speak several languages: detect and store locale, use message catalogs with plurals, localize commands, dates and numbers.

Payments

Payments in bots

Accept money in a bot correctly: Telegram invoices and Stars, Discord SKUs and entitlements, external checkout, webhooks and refunds.

Scale

Scaling, queues and monitoring

Grow from one process to many: split ingestion from work with queues, shard gateways, and watch the right metrics with useful alerts.

Legal

Legal, terms and privacy

What bot builders should know: platform developer terms, privacy policies, GDPR-style rights, retention, AI disclosure and spam rules.

AI security

Prompt injection defense

Defend LLM bots against direct and indirect prompt injection with least privilege, confirmation, isolation, output checks and red-team tests.

Telegram

Telegram bot in Python

From BotFather to a deployed bot: handlers, conversations, inline buttons, error handling, persistence and switching from polling to a webhook.

Discord

Discord bot in Python

Application setup, intents, a CommandTree with typed slash commands, deferring, buttons, permissions, error handling and deployment.

Basics

Bot commands and menus

Name commands well, register them per platform, localize them, scope them to the right users and fall back to buttons where commands do not exist.

Automation

Scheduled messages and reminders

Store jobs in a database, poll for due work, handle time zones and DST, respect platform limits and deliver each reminder exactly when it should.

DevOps

Docker for bots

Package Node and Python bots in containers with non-root users, health checks and Compose for Redis or Postgres.

DevOps

Logging for bots

Structure logs, redact tokens, trace webhook requests and alert on silence.

Security

Webhook security deep dive

Verify signatures, reject old timestamps, avoid SSRF when fetching URLs and ACK fast.

Architecture

Multi-platform bots

Design a core domain with thin platform adapters instead of copy-pasting handlers.

Privacy

Bot analytics and privacy

Count commands and errors, not private message contents. Retention and disclosure tips.

Basics

Env and config

Separate secrets from config, validate on boot, and keep per-environment files out of git.

Reliability

Error handling

Classify errors, reply safely to users, retry with backoff and capture enough context for debugging.

Telegram

Telegram webhooks in production

Set up setWebhook with secret_token, reverse proxies and safe rotations.

Discord

Discord interaction timeouts

Acknowledge slash commands in time, defer long work and edit the response.

Data

SQLite for bots

Use SQLite for single-node bots, WAL mode, backups and clear migration paths to Postgres.

Architecture

Feature flags for bots

Roll out commands to a guild allow-list, kill switches and per-platform flags.

Basics

Documenting your bot

Write a clear /help, permissions list, privacy summary and support path.

Reliability

Idempotency for bots

Make payments, tickets and role grants safe under webhook retries.

Reliability

Graceful degradation

Fallback replies, cached answers and feature flags when dependencies fail.

DevOps

Backup and restore

What to back up, how often, and how to test restores on a staging bot.

Reliability

Rate-limit strategies

Queues, token buckets, per-chat limits and honoring Retry-After.

Basics

Admin commands

Restrict /broadcast and /stats to owner ids without shipping a full dashboard.

Basics

Message formatting

Pick parse modes, escape user content and keep buttons usable.

Architecture

Queues for bots

Move LLM calls and broadcasts off the webhook request path.

Hosting

DNS for webhooks

Point hooks.example.com at your VPS or edge worker correctly.

DevOps

Versioning bots

Tag releases, announce breaking command changes and keep a changelog users can read.

Security

Input validation

Length limits, allow-lists, rejecting unexpected attachment types.

Reliability

Chaos testing bots

Break dependencies on purpose in staging.

DevOps

Canary deploys

Route a fraction of chats to the new version.

Reliability

SLAs and error budgets

Define uptime goals that match your on-call reality.

Basics

Structured arguments

Prefer typed slash options over fragile regex parsing.

Basics

Chat pagination

Buttons for next/prev beat huge walls of text.

Discord

Ephemeral replies

Keep admin noise out of public channels.

Telegram

Group privacy mode

Know what your bot can and cannot see.

WhatsApp

WhatsApp templates overview

Outside the 24h window you need approved templates.

Matrix

Matrix bots quickstart

Homeserver access tokens and sync loops.

Platforms

Reddit API rules

Use official APIs and stay within rate limits.

DevOps

Three pillars of observability

What to collect first when you run bots alone.

DevOps

Blue-green bot deploys

Two URLs, one cutover, zero missed updates.

Reliability

Dead-letter queues

Keep poison messages out of the hot path.

Reliability

Circuit breakers

Stop calling a failing dependency for a while.

Security

Secrets rotation runbook

Tokens, webhook secrets and OAuth clients without downtime.

Reliability

Load testing webhooks

Synthetic traffic, not production users.

Architecture

Multi-tenant bots

Guild/workspace ids as tenants and hard data boundaries.

Basics

Bot UX writing

Short, clear, actionable messages with an escape hatch.

Architecture

Schedulers vs chat process

Separate cron workers from the webhook/gateway process.

Data

Postgres SKIP LOCKED

A durable queue without Redis for small fleets.

Reliability

Redis rate limits

Token buckets and fixed windows keyed by chat id.

AI

OpenAI-compatible APIs

Base URLs, keys, timeouts and aborting streams.

AI

Streaming replies

Edit messages as tokens arrive without spamming edits.

AI

Tool calling safety

Allow-lists, confirmations and argument schemas.

AI

Vector store ops

Reindex, delete-by-user and stale chunk cleanup.

Discord

Discord sharding intro

Guild thresholds, shard formula and session starts.

Telegram

Telegram Mini Apps notes

Init data validation and opening from a bot button.

Slack

Slack interactivity ACK

Three-second window and response_url follow-ups.

WhatsApp

WhatsApp 24h window

When free-form replies are allowed vs templates.

Matrix

Matrix E2EE bots

When bots can participate in encrypted rooms.

DevOps

Infra as code

Terraform/Pulumi tips without over-engineering a single bot.

DevOps

Container healthchecks

Wire Docker HEALTHCHECK to /healthz correctly.

Security

Safe dependency updates

Dependabot, staging bots and reading changelogs.

Legal

Abuse reports

Respond, pause, document, restore or terminate.

Basics

Accessible messages

Do not rely on color or emoji alone for meaning.

Basics

Localization plurals

Use ICU/CLDR plural forms, not naive +s.

Security

Webhook mTLS notes

When mutual TLS is worth it inside a VPC.

Reliability

ACK latency SLOs

Measure time-to-200 separately from time-to-reply.

Architecture

Bot config schema

Validate config at boot; fail fast on typos.

Security

Egress IP allowlists

Optional defense in depth after signature checks.

Privacy

Transcript export

DSAR-friendly exports without over-collecting.

Basics

Bot naming

Clear identity, no impersonation, stable handle.

Architecture

Horizontal scaling webhooks

Dedup, sticky sessions myths and shared state.

Telegram

Single-flight polling

Only one getUpdates loop per token.

Discord

Discord audit logs

Intents, permissions and privacy caveats.

Slack

Slack App Home

Publish views carefully; keep payloads small.

Costs

LLM cost attribution

Meter tokens with tenant labels in your logs.

Security

Backup encryption

Encrypt at rest and test restores with the key.

Basics

Progressive /help

Short help first; details on demand.

Reliability

Bot status pages

Separate status from marketing; say what is broken.

Architecture

Email to chat

Parse carefully; never execute links from email.

Security

Upload scanning

Size caps first; async scan before processing.

Discord

Guild install analytics

Count installs, not message contents.

Telegram

Telegram Business bots

Read current Bot API business methods before shipping.

Architecture

Worker concurrency

Cap in-flight LLM calls per process.

Security

Webhook replay protection

Reject old timestamps and reuse of event ids.

Reliability

On-call basics for bot teams

Alerts that wake humans should be rare, actionable and tied to user impact.

Basics

Choosing a language for your first bot

Pick the ecosystem you can ship and operate — not the trendiest runtime.

DevOps

Shadow traffic for bot deploys

Replay or fork a slice of webhooks to a candidate build before cutting DNS.

Telegram

Registering bot commands with setMyCommands

setMyCommands controls the in-client command menu; scopes decide where each command appears.

Telegram

Inline keyboards without callback chaos

inline buttons persist on old messages so callback_data must stay backward compatible.

Telegram

Bots in Telegram forum topics

forum topics require echoing message_thread_id or replies fall into General.

Telegram

Downloading Telegram files safely

getFile returns a temporary path; treat downloads as untrusted binary input.

Telegram

Handling Telegram Bot API 429 responses

Telegram signals overload with 429 and retry timing you must honor.

Discord

Message components and buttons

component interactions must ACK fast; version custom_id and never store secrets there.

Discord

Slash command autocomplete

autocomplete handlers have a short deadline and must stay side-effect free.

Discord

Modal forms for Discord bots

modals collect structured text you must length-check and sanitize.

Discord

Presence and activity updates

presence updates are gateway traffic; flapping wastes session budget

Discord

Working with Discord threads

threads need Create Public/Private Threads permission and archival handling.

Discord

Channel webhooks vs bot tokens

incoming webhook URLs are secrets suited to simple posts not slash UX.

Discord

Role checks for privileged commands

authorize by role id because names are renamable.

Discord

Select menus for Discord bots

select values must be allowlisted like any form input.

Discord

User and message context menus

context menus act on a target; verify the invoker may touch that target.

Discord

Guild scheduled events from bots

Manage Events permission plus UTC storage for start and end.

Discord

Custom emoji and stickers in replies

custom emoji need guild availability; fall back to unicode.

Discord

Gateway resume and session restart

resume correctly after disconnects to avoid burning session_start_limit.

Discord

MESSAGE_CONTENT intent checklist

privileged message content requires portal enablement and a clear need.

Discord

Discord embed field limits in practice

embeds reject oversized titles fields and totals; validate before send.

Discord

Resolving channel permissions for actions

compute effective permissions before send react or manage messages.

Discord

Audit log reasons from bots

supply clear reason strings without embedding secrets or PII dumps

Discord

Working alongside Discord AutoMod

coordinate bot actions with AutoMod so you do not fight the platform

Discord

Invite attribution basics

track vanity and invite uses carefully and disclose analytics

Discord

Timeout members via moderation API

communication_disabled_until needs rights confirmation and an audit reason

Discord

Localizing slash command names

command name localizations have charset and length rules per Discord docs

Slack

Validating Block Kit payloads

Block Kit has strict element limits; invalid payloads fail at runtime

Slack

Slack global and message shortcuts

shortcuts still need 3s ACK and may open modals

Slack

Slash command acknowledgment patterns

slash commands must ACK quickly then use response_url or chat APIs

Slack

External select options load

options load endpoints must respond fast with filtered choices

Slack

Legacy workflow steps vs modern automation

prefer current Slack automation primitives; keep secrets out of step configs

Slack

Assistant-style threads in Slack

keep assistant UX ephemeral where needed and respect channel context

Slack

Handling file_shared events

file events need download auth and malware scanning before processing

Slack

User token scopes vs bot tokens

prefer bot tokens; user tokens widen blast radius and need clearer UX consent

Slack

Slack event_id deduplication

Slack may retry events; dedupe on event_id in a shared store

Slack

App Home publish rate limits

views.publish is rate-limited; coalesce updates per user

Slack

Event metadata and correlation

propagate enterprise/team/user ids into logs without storing message bodies

Slack

Interactivity payload versions

parse block_actions carefully and version private_metadata

Slack

Socket Mode reconnect storms

backoff reconnects and cap concurrent connections per app

Slack

Enterprise Grid considerations

team vs enterprise ids differ; test installs across workspaces

Slack

Link unfurls from Slack bots

unfurl handlers must be fast and must not leak private link content broadly

WhatsApp

WhatsApp template categories

template category choice affects approval and pricing treatment; follow Meta rules

WhatsApp

WhatsApp media message sends

media uploads need type allowlists size caps and hosted URLs Meta can fetch

WhatsApp

WhatsApp interactive buttons

interactive replies are session-bound; handle button payloads as untrusted input

WhatsApp

Phone number quality rating awareness

poor quality ratings throttle delivery; monitor and fix template/user opt-in issues

WhatsApp

Capturing WhatsApp opt-in correctly

store proof of opt-in and honor opt-out quickly

WhatsApp

WhatsApp Cloud API webhook fields

parse entry changes carefully and ACK before slow work

WhatsApp

WhatsApp Graph error codes in bots

map common Graph errors to user-visible guidance without leaking tokens

WhatsApp

Multi phone-number bot routing

route by phone_number_id and isolate tokens per number

WhatsApp

WhatsApp Flows notes for bot builders

Flows are a separate surface; validate endpoints and do not mix with chat ACK paths carelessly

WhatsApp

WhatsApp business profile fields

keep profile description consistent with bot /help and privacy text

AI

System prompts for chat bots

keep system prompts versioned short and free of secrets

AI

Chunking strategies for RAG bots

chunk size and overlap affect retrieval quality and cost

AI

Embedding model upgrades

changing embedding models requires reindexing and dual-read plans

AI

Output filters before send

scan model output for secrets and policy violations before chat send

AI

Prompt injection defenses

treat retrieved docs and user text as untrusted; constrain tools

AI

Routing between models

send easy tasks to cheaper models; keep an allowlist of model ids

AI

Structured JSON outputs from LLMs

validate JSON schema before side effects; repair carefully

AI

Citations and grounded answers

do not invent citations; show retrieval misses honestly

AI

Per-request token budgets

hard-cap prompt and completion tokens to protect latency and cost

AI

Offline eval harness for bot prompts

keep a golden set of prompts and expected traits in CI

AI

Timeouts around tool calls

every tool call needs a deadline and a user-visible fallback

AI

Conversation memory windows

summarize or truncate history; never ship unbounded transcripts to the model

AI

PII redaction before LLM calls

strip emails phones and tokens from prompts when policy requires

AI

Fallback models on provider outages

define ordered fallbacks and circuit-break open providers

AI

Layered guardrails for agents

combine allowlists schemas human confirmations and output filters

DevOps

Health endpoint contracts for bots

separate liveness from readiness; keep liveness dependency-light

DevOps

Draining connections on deploy

fail readiness then wait for in-flight ACKs before exit

DevOps

Log sampling under high chat volume

sample debug logs; always keep security and ACK failures

DevOps

Naming metrics for bot fleets

stable metric names beat clever ones; avoid high-cardinality labels

DevOps

Hot-reloading bot config safely

reload non-secret config with validation; never hot-reload tokens casually

DevOps

Expand/contract migrations for bots

add nullable columns first; remove later after dual-write window

DevOps

Canary guilds and tenants

ship risky commands to a pilot set before global enable

DevOps

SBOM and dependency inventory for bots

generate SBOM in CI and track critical advisories

DevOps

Pinning language runtimes in images

pin major.minor of Node/Python in Docker digests when possible

DevOps

Secret scanning in bot repositories

block commits that look like bot tokens or webhook URLs

DevOps

Active-active bots across regions

share idempotency and rate-limit state; avoid dual polling

DevOps

Cron jitter for scheduled bot jobs

spread minute-0 jobs to avoid thundering herds on shared APIs

DevOps

OpenTelemetry traces for webhooks

propagate trace context from ACK through queue to LLM

DevOps

Cleaning up stale feature flags

remove flags after rollout to avoid permanent branching debt

DevOps

Signing release artifacts

sign container images or zip artifacts and verify in deploy

DevOps

Backup restore drills for bot data

schedule restores into isolated envs; measure RTO honestly

DevOps

Egress proxies for bot HTTP

centralize egress for allowlists and TLS policy

DevOps

Parsing upstream rate-limit headers

honor Retry-After and vendor-specific remaining headers

DevOps

Process supervision choices for bots

systemd/pm2/k8s each need SIGTERM handlers and restart budgets

DevOps

Fail-fast config validation on boot

validate env against schema before accepting traffic

Security

Storing bot tokens at rest

encrypt tokens at rest and restrict decrypt roles

Security

Webhook secret entropy requirements

generate high-entropy secrets; avoid human-memorable phrases

Security

Constant-time secret compares

use timing-safe compares for HMAC and secret tokens

Security

SSRF guards for bot-fetched URLs

block link-local and metadata IPs when fetching user URLs

Security

Admin action audit logs

record who ran privileged commands with correlation ids

Security

CSP for bot admin dashboards

lock down script sources on any HTML admin UI

Security

OAuth state and PKCE for bot installs

validate state and prefer PKCE when the platform supports it

Security

Session fixation on bot dashboards

rotate session ids on login and use Secure cookies

Security

Security impact of floating versions

floating latest tags pull surprise breakages and advisories

Security

Lightweight threat models for bots

list assets attackers want: tokens webhooks and user PII

Security

WAF rules in front of webhooks

allow platform user-agents carefully; do not block signature failures wrongly

Security

Separating signing and API keys

different keys for webhook verify vs outbound API calls

Security

Security headers on bot HTTP servers

set minimal headers even on JSON APIs behind TLS terminators

Security

Abuse-oriented rate limits

limit expensive commands per user harder than cheap reads

Security

Handling leaked bot tokens

revoke first rotate second then audit sends

Data

Indexing chat and user ids

index text ids used in WHERE clauses; avoid leading-wildcard searches

Data

Transactional outbox for bot sends

write outbound intents in the same DB transaction as state changes

Data

Inbox table for webhook dedupe

store event ids with TTL longer than platform retry windows

Data

Soft deletes for chat records

prefer soft delete when users may request export later

Data

DB pools for webhook workers

size pools to concurrency limits; never hold connections during LLM calls

Data

Read replicas for bot queries

send heavy analytics reads to replicas; keep ACK path on primary

Data

Schema comments as documentation

comment tables with ownership and retention in migrations

Data

JSON columns for bot state

use JSON for evolving optional fields; keep hot filters as real columns

Data

Avoiding long migration locks

batch backfills; avoid rewriting huge tables in one txn

Data

Scheduled retention jobs

delete or anonymize expired rows on a schedule you can prove

Data

Idempotent upserts for bot state

upsert on natural keys from platform event ids

Data

Queue payload size budgets

keep jobs small; store blobs in object storage by reference

Data

Storing user timezones

store IANA names not numeric offsets alone

Data

Marking PII columns explicitly

tag PII in schema docs and restrict SELECT in analytics roles

Data

PII in database backups

encrypt backups and limit who can restore identifiable data

Architecture

Hexagonal layout for bot codebases

isolate platform adapters from domain logic for testability

Architecture

Command bus for chat intents

map slash/text intents to command handlers with authz hooks

Architecture

Light event sourcing for bots

append domain events for critical audits without full CQRS theater

Architecture

Anti-corruption layers for platforms

translate platform payloads into your domain types at the edge

Architecture

Canceling long-running bot sagas

support user cancel and deadlines across multi-step flows

Architecture

Backpressure from chat to workers

shed load when queues deepen instead of unbounded accept

Architecture

Shared kernels across bot platforms

share domain modules; keep transport packages separate

Architecture

Sandboxing bot plugins

load third-party plugins with allowlisted capabilities

Architecture

Versioning internal bot APIs

version HTTP and queue contracts independently of chat UX

Architecture

Contract tests for platform adapters

freeze fixtures per platform and fail CI on parser drift

Architecture

Bulkheads between dependencies

isolate thread/async pools per dependency to stop cascades

Architecture

Preventing retry storms

cap retries jitter and use idempotency keys everywhere

Architecture

State machines for conversations

explicit states beat boolean soup for multi-turn flows

Architecture

Actor-ish per-chat concurrency

serialize work per chat id to avoid races

Architecture

Testing ports without network

fake platform ports in unit tests; reserve network for contract suites

Basics

User onboarding checklist for bots

welcome permissions privacy and first success action in order

Basics

Writing error messages users understand

say what failed how to fix and how to get help without stack traces

Basics

Empty states in bot UX

when lists are empty say how to create the first item

Basics

Confirmations that prevent mistakes

summarize the irreversible action before the confirm button

Basics

Progress updates for long tasks

edit a single status message instead of flooding the chat

Basics

Organizing i18n keys for bots

namespace keys by feature; avoid concatenating translated fragments

Basics

Text alternatives for rich messages

provide plain-text fallbacks beside embeds and images

Basics

Examples inside /help

show one copy-pastable example per top command

Basics

Tone guidelines for bot replies

document voice do/don't so LLM and templates stay consistent

Basics

Support macros for human handoff

give humans macros that include correlation ids

Basics

Announcing changes inside the bot

optional /changelog command summarizing user-visible changes

Basics

Explaining permission requests

say why each scope is needed before the install link

Basics

Formatting for mobile chat clients

short paragraphs; avoid wide ASCII tables

Basics

First-run permission diagnostics

detect missing permissions and tell admins how to fix invites

Basics

Keeping personality within bounds

personality should not override safety refusals or legal text

Matrix

Joining and leaving Matrix rooms

handle invites knock and leave cleanly; log room ids

Matrix

Appservice bridge basics

appservices need correct namespaces and HS registration YAML

Matrix

Matrix HS rate limits

respect HS rate limits; backoff soft-fail user actions

Matrix

Push rules awareness for bots

bots should not rely on noisy notifies; prefer explicit mentions carefully

Matrix

Reading room state events

cache state carefully and invalidate on state events

Hosting

TLS certificate renewal monitoring

alert before expiry; test renewals in staging

Hosting

Reverse proxy buffer sizes

size request buffers for webhook bodies you actually accept

Hosting

CDNs in front of webhooks

usually terminate TLS at origin/proxy; avoid caching POST webhooks

Hosting

VPS firewall defaults for bots

deny by default; allow 22/80/443 and admin sources carefully

Hosting

Shipping logs to object storage

batch upload rotated logs with encryption and retention

Hosting

Swap and OOM behavior for bot hosts

prefer OOM visibility over hidden swap thrash for latency-sensitive bots

Hosting

Clock sync for signature checks

skew breaks Slack timestamp checks; keep NTP healthy

Hosting

Disk watermarks before log floods

alert on disk used before webhook workers fill the volume

Hosting

IPv6 for webhook endpoints

publish AAAA only if your stack listens and platforms can reach you

Hosting

Capacity planning for chat spikes

plan for launch spikes with queue depth and ACK SLOs

Reliability

Working an ACK error budget

burn alerts should change deploy pace not just page endlessly

Reliability

Synthetic checks for bots

probe /healthz and a signed fake webhook path in staging

Reliability

Pager routing for bot incidents

route by severity; critical for ACK outages warning for queue depth

Reliability

Blameless postmortems for bot outages

capture timeline impact and action items with owners

Reliability

SLOs on dependencies not just bots

track LLM and DB success ratios separately from chat ACK

Reliability

Load shedding strategies

reject low-priority work when ACK budget burns

Reliability

Chaos experiments on webhook paths

inject latency and 500s in staging only with kill switches

Reliability

Linking alerts to runbooks

every page must include a runbook URL and correlation hint

Reliability

Change freeze windows

freeze risky deploys during peak launches you cannot staff

Reliability

Warm standby bot processes

keep a standby region ready with synced secrets and data plan

Privacy

DSAR export playbooks for bots

authenticate the requester and deliver via short-lived URLs

Privacy

DSAR deletion playbooks

delete or anonymize across DB vectors and backups policy

Privacy

Logging consent events

store when how and what was consented without message bodies

Privacy

Age-gated bot features

avoid collecting child data; follow platform policies

Privacy

Inventorying subprocessors

list LLM hosts and analytics vendors in privacy text

Privacy

Data minimization for chat logs

store ids and outcomes not full transcripts by default

Privacy

Cross-border data notes for bots

know where your host and LLM providers store data

Privacy

Privacy by default toggles

defaults should share less; opt-in to analytics

Privacy

Showing retention in product UI

surface retention periods next to export/delete commands

Privacy

Breach notification runbook sketch

define who decides who notifies and where evidence lives

Telegram

Reply keyboards vs inline keyboards

reply keyboards replace the client keyboard; remove them explicitly when done.

Telegram

Telegram webhook IP allowlists

if you filter ingress, keep Telegram's published ranges updated and still verify secret_token.

Telegram

Telegram deep links and start payloads

t.me deep links pass start payloads into /start as untrusted input.

Telegram

Editing and deleting bot messages

edits fail on identical content or old messages; deletes need rights in groups.

Telegram

sendChatAction typing indicators

chat actions expire within seconds; refresh during long work then stop.

Telegram

Validating Telegram Mini App initData

initData is HMAC-signed with the bot token; skipping validation forges user identity.

Telegram

Moderation with banChatMember and restrictChatMember

moderation calls can lock users out; require confirmation and audit trails.

Telegram

Telegram Payments integration notes

pre-checkout queries need fast answers and successful_payment must be idempotent.

Telegram

Authorization with getChatMember

privileged actions should re-check that the caller is still a member or admin.

Telegram

Parsing message entities safely

entity offsets use UTF-16 length; naive string indexes break on emoji.

Telegram

Inline mode and answerInlineQuery

inline queries need fast answersInlineQuery responses and cache_time choices.

DevOps

Client timeouts for outbound platform calls

set explicit timeouts on every Telegram Discord Slack HTTP client call

Architecture

Idempotency-Key for bot-originated HTTP

send Idempotency-Key when calling payment or ticket APIs

Architecture

Experiments and A/B flags in bots

assign sticky variants per chat without leaking into logs as PII unnecessarily

Basics

Bot avatar and profile consistency

keep avatar description and /about aligned across platforms

Basics

Command aliases and redirects

map old commands to new ones during renames with a deprecation window

Discord

Per-guild configuration storage

isolate config by guild id and validate on write

Discord

Daily digests into Discord channels

render digests offline and send once; avoid per-item spam

Slack

Posting to Slack canvases carefully

follow current canvas APIs; keep secrets out of canvas text

Telegram

Admin tools for forum topics

close reopen and rename topics only with clear authz

WhatsApp

Catalog messages overview for bots

catalog features need commerce setup; verify current Cloud API support

AI

Separating safety filters from prompts

keep policy filters in code not only in prompt text

AI

ACL filters on vector retrieval

filter retrieved chunks by tenant before prompting

Data

Redis pub/sub for bot fan-out

use pub/sub for notify; still persist durable work in a queue

Data

SQLite WAL mode for bots

enable WAL for better concurrent readers on single-node bots

DevOps

Kubernetes probes for bot deployments

configure liveness readiness and startup probes with realistic delays

DevOps

Helm values for bot charts

keep secrets out of values.yaml; use sealed secrets or external refs

Security

mTLS between bot internal services

authenticate service-to-service calls beyond a flat private network

Security

Overlapping HMAC secret rotation

accept dual secrets during rotation windows

Reliability

Status embeds for incidents

post structured incident embeds with next-update times

Reliability

Poison message handling

detect repeated failures and park payloads in DLQ with redaction

Matrix

Device keys hygiene for Matrix bots

protect device keys like passwords if participating in E2EE

Hosting

Filesystem snapshots before upgrades

snapshot disks before OS or major dependency upgrades

Privacy

First-message privacy banners

show a short privacy notice on first interaction per user

Architecture

Testing domain logic without Discord SDK

unit-test pure handlers with fake ports

Basics

Button label length and clarity

prefer verbs on buttons; keep labels short for mobile

Slack

Using channel bookmarks with bots

link runbooks via bookmarks instead of pinning secrets

Discord

Discord forum channels vs text channels

forum posts need thread semantics; do not assume classic text channel behavior

WhatsApp

Throughput planning for WhatsApp sends

pace template sends; watch quality rating and throughput limits in current docs

AI

Alerting on LLM spend anomalies

alert on sudden per-tenant cost spikes not only monthly totals

Data

Partitioning large chat event tables

partition by time for retention drops and query pruning

Security

Device trust for admin dashboards

require 2FA and consider device checks for destructive admin actions

Reliability

Multi-window burn-rate alerts

combine fast and slow burn windows on ACK SLOs

Hosting

cgroup memory limits for bot containers

set memory limits so one leak cannot eat the host

DevOps

Pre-commit hooks for bot repos

lint secret patterns and formatters before push

Privacy

Cookie notices on bot marketing sites

if the marketing site sets non-essential cookies disclose them

Suggested learning path

  1. Read Getting started to choose a platform and an architecture.
  2. Build a first bot on one platform: Telegram is the fastest to set up; Discord and Slack teach you interactions and scopes.
  3. Learn the plumbing: APIs and webhooks, then hosting.
  4. Harden it with security and reliability.
  5. Add intelligence with AI chatbots and agents.