Tutorial for a Webchat AI Agent that books into a real calendar (github.com)

🤖 AI Summary
This tutorial shows how to build a minimal web-chat AI agent that actually books real appointments by combining an LLM (e.g., OpenAI with tool/function calling) and the Block API as a single “book_appointment” tool. The example is a tiny Node.js app (Express + dotenv + openai) that serves a simple HTML/JS chat UI, exposes POST /api/chat, and uses an LLM to collect missing details, call the book_appointment tool, poll for completion, and return a user-friendly confirmation. The key takeaway: from a webchat it takes one small tool + one HTTP workflow to book across any connected platform — a practical pattern for production agent tooling. Technically, the server implements bookAppointmentViaBlock which POSTs to /v1/actions (Block) and receives a jobId with HTTP 202, then polls GET /v1/jobs/{jobId} until status is queued, in_progress, success, or error; on success the result field contains booking details. Example payload includes action: "BookAppointment", connectionId, datetime, provider, service, customer info and note. Requirements: Node 18+, OPENAI_API_KEY, BLOCK_API_KEY, CONNECTION_ID, and a Block base URL. The tutorial notes a 2-minute polling timeout (or use webhooks), suggests adding tools like get_availability, persisting chat history, styling/deploying, and highlights async tool-calling as a simple, extensible pattern for real-world conversational automation.
Loading comments...
loading comments...