all blogs
agentic ai

Building PseudoChat: an AI-powered Slack chatbot with webhooks, FastAPI and Together AI

Wiring Slack events to an LLM through a verified webhook endpoint — and designing around Slack's three-second deadline.

PseudoChat request flow in two rows. The synchronous row, which must finish inside three seconds: a Slack event arrives at POST /slack/events, the HMAC-SHA256 signature and timestamp are verified, and a 200 is returned; an invalid signature branches off to 403 Forbidden. The background row, which has no deadline: the message is parsed and the bot mention stripped, then a known command such as help, ping or echo goes to its handler, while anything else goes to Together AI. Both paths end by posting back to Slack via chat.postMessage.
The three-second deadline is what splits this into two rows: verify and acknowledge first, generate afterwards.

01 The short version

PseudoChat answers mentions and direct messages in Slack using an LLM. Slack's event subscriptions POST to a FastAPI service, which verifies the request, decides whether it's a recognised command or a general question, and replies in the channel.

Together AI serves the model — LLaMA 3.3 70B — and ngrok exposes the local server during development so Slack's callbacks can actually reach it.

The security piece is request verification: HMAC-SHA256 signing with timestamp validation, so a spoofed request can't drive the bot.

The constraint that shapes the whole design is Slack's three-second response deadline. Generation takes longer than that, so the work moves to a background task and the endpoint acknowledges immediately.

02What you'll take away

  • Verify every Slack request with HMAC-SHA256 and a timestamp check — the signing secret is the only thing between your bot and anyone who learns the URL.
  • Slack gives you three seconds. Acknowledge first, generate in a background task, post the result afterwards.
  • Routing known commands to custom handlers and falling back to the model keeps deterministic behaviour where you need it.
  • ngrok covers local development, and the same handler runs unchanged once it's deployed.