Lesson content
API Basics for Non-Coders — Tokens, Keys, and Webhooks
This is the lesson that bridges the gap between "I understand the concept" and "I can actually build this." If you've never worked with APIs before, don't worry — by the end of this lesson, you'll understand exactly what they are and how they connect your AI to messenger platforms.
What Is an API?
API stands for Application Programming Interface. Think of it as a translator between two systems. When your AI sales manager needs to read a message from Telegram and send a response, it doesn't go into the Telegram app and type — it uses Telegram's API to exchange messages programmatically.
Analogy: imagine a restaurant. You (the client) don't go into the kitchen to cook your food. Instead, you tell the waiter (API) what you want, the waiter tells the kitchen, and brings you the result. APIs work the same way — they take your request, pass it to the service, and return the result.
API Key / Token — Your Identity
An API key (or token) is like a password that identifies your application. Every API requires one. When your AI sends a message through Telegram, Telegram needs to know: "Who is sending this? Are they authorized?"
The API key answers that question. It's a long string of characters:
sk-ant-api03-abc123xyz789... ← Anthropic API key (for Claude)
7891234567:AAH_some_long_token ← Telegram Bot token
EAAGm0PX4ZC... ← Instagram/Meta API token
Critical rule: API keys are like passwords. Never share them publicly, never commit them to Git, never paste them in public chats. Store them in a .env file that stays on your machine only.
Webhook — The Notification System
A webhook is the opposite of an API call. Instead of YOUR app asking "any new messages?" every 5 seconds (polling), the messenger platform tells YOUR app "hey, a new message just arrived!" (push notification).
How it works:
You give Telegram a URL (your webhook address): https://your-server.com/webhook/telegram
When a client sends a message to your bot, Telegram sends that message to your URL
Your server receives it, processes it through the AI, and sends a response back via the API
Client sends message to your Telegram bot
↓
Telegram calls YOUR webhook URL with the message data
↓
Your server receives the message
↓
Your server sends message + context + skill to Claude API
↓
Claude generates a response
↓
Your server sends the response back via Telegram API
↓
Client sees the response in Telegram
What You'll Need
For each integration, you'll need:
PlatformWhat you needWhere to get it
Claude AIAPI keyconsole.anthropic.com → API Keys
TelegramBot token@BotFather in Telegram
InstagramPage token + App IDdevelopers.facebook.com
WhatsAppBusiness API tokendevelopers.facebook.com (Meta Business Suite)
The .env File
All your keys go in one file:
# /config/.env
# Claude AI
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
# Telegram
TELEGRAM_BOT_TOKEN=7891234567:AAH_your_token_here
# Instagram / Meta
META_PAGE_TOKEN=EAAGm0PX4ZC_your_token_here
META_APP_SECRET=your_app_secret_here
# WhatsApp
WHATSAPP_TOKEN=your_whatsapp_token_here
WHATSAPP_PHONE_ID=your_phone_id_here
# Server
WEBHOOK_URL=https://your-server.com
Tell Claude Code to create this structure:
Create a /config/.env file with placeholders for all API keys I'll need:
Anthropic, Telegram, Instagram, WhatsApp.
Also create a /config/.env.example with the same structure but without real values.
Add .env to .gitignore so it's never committed.
Claude Code Handles the Hard Part
Here's the key insight: you don't need to write the API integration code yourself. You'll tell Claude Code what you want, and it will write the code that connects everything. Your job is to:
Get the API keys (we'll walk through each one in the next lessons)
Put them in the .env file
Tell Claude Code what to build
Test and refine
APIs, tokens, and webhooks sound technical, but they're really just three concepts: an API is how apps talk to each other, a token is your ID badge, and a webhook is a notification bell. You don't need to memorize HTTP methods or JSON formats — Claude Code handles that. You just need to know what these things are and where to get the keys.