Documentation
Everything you need to set up your assistant: keys, voice, and connecting your website.
1. Keys you may need
Gemini (AI) — required unless you're on Pro with a platform key.
Get a free key at aistudio.google.com/apikey → Dashboard → AI keys → paste. Add several; if one hits its limit the bot uses the next.
Cloudinary (media) — only if you send photos/videos.
At cloudinary.com (free): copy your cloud name and create an unsigned upload preset. Put both in Dashboard → Media. No secret/API key is stored — uploads go straight from your browser.
Telegram.
Bot: @BotFather → /newbot → paste the token (no phone, no api_id/hash). Personal account: get api_id + api_hash from my.telegram.org, then phone + login code.
2. Custom voice API (ElevenLabs or any TTS)
By default the bot uses free voice (edge-tts). For premium voice, add a provider in Dashboard → Voice. Every field explained:
- Name — any label, e.g. ElevenLabs.
- Voice id — the provider's voice id. It replaces {voice} in the endpoint/body.
- Endpoint — the TTS URL. May contain {voice}. ElevenLabs: https://api.elevenlabs.io/v1/text-to-speech/{voice}
- Auth header name — e.g. xi-api-key (ElevenLabs) or Authorization (OpenAI).
- Auth header value — your key. For "Bearer" APIs, type Bearer YOUR_KEY. Stored encrypted.
- Body template — JSON sent to the API; use {text} for the reply text. ElevenLabs: {"text":"{text}","model_id":"eleven_multilingual_v2"}
- Response type — audio (most TTS return raw audio), or base64 / url if the audio is inside a JSON field.
- JSON path — only for base64/url: the dot-path to the field, e.g. data.audio.
The customer just types "voice please / ভয়েস দাও" and the bot replies with a voice note.
3. Website / API integration (live product search)
This lets the bot answer from your live website data. For every customer message, Autogram sends a POST to your URL and uses what you return.
Request Autogram sends:
POST https://yourstore.com/api/assistant
Content-Type: application/json
(optional) your-auth-header: your-secret
{ "query": "do you have a python course?" }Response your API should return (JSON with a context field — answer/result/data/text also accepted):
{ "context": "Python Basics — 1500tk — in stock. 20 lessons, beginner." }Inside your endpoint you search your own database for the query and return the matching product details. The bot then answers the customer using only that. Keep it fast (≤8s).
Example — Node / Express:
// Node/Express example: /api/assistant
// Autogram POSTs { "query": "<customer message>" }.
// Return { "context": "<facts the bot should use>" }.
app.post("/api/assistant", async (req, res) => {
const q = (req.body.query || "").toLowerCase();
// 1) search YOUR data (DB, sheet, CMS…) for matching products/courses
const items = await db.products.find({
// simple keyword match — use your own search
$text: { $search: q }
});
// 2) build a short, factual context string
if (!items.length) {
return res.json({ context: "No matching product found." });
}
const context = items.slice(0, 5).map(p =>
`${p.name} — ${p.price}৳ — ${p.inStock ? "in stock" : "out of stock"}. ${p.summary}`
).join(" | ");
// 3) return it
res.json({ context });
});Example — Python / Flask:
# Python/Flask example
@app.post("/api/assistant")
def assistant():
q = (request.json or {}).get("query", "").lower()
items = search_products(q) # your own search
if not items:
return {"context": "No matching product found."}
ctx = " | ".join(
f"{p['name']} — {p['price']}tk — "
f"{'in stock' if p['stock'] else 'out of stock'}. {p['summary']}"
for p in items[:5]
)
return {"context": ctx}Set the URL + optional auth header in Dashboard → Website / API, turn it on, then hit "Test endpoint" to confirm it works before going live. If you have no site/DB, you can instead add products manually in Dashboard → Products.
⚠️ Important: use partial / keyword search, not exact match.
Autogram sends the customer's whole sentence as query (e.g. "do you have a video editing course?"). If your endpoint does an exact/whole-string match, it will wrongly say "not found" even when you have 3 video-editing courses. Split the query into keywords, drop filler words, and match if any keyword appears in a product's name/category/tags.
const q = (req.body.query || "").toLowerCase();
// 1) drop filler/stop words, keep real keywords
const stop = ["do","you","have","any","is","there","a","the","course",
"ase","naki","ki","ache","কি","আছে","কোর্স","নাকি"];
const words = q.split(/[\s,?!।]+/).filter(w => w && !stop.includes(w));
// 2) partial (contains) match on name/category/tags — ANY keyword hits
const all = await db.products.find({});
const items = all.filter(p => {
const hay = (p.name + " " + p.category + " " + (p.tags||[]).join(" ")).toLowerCase();
return words.some(w => hay.includes(w));
});
// 3) return matches (or a clear "not found")
res.json({ context: items.length
? items.slice(0,5).map(p => `${p.name} — ${p.price}৳ — ${p.summary}`).join(" | ")
: "No matching course found." });Even better: match by category (return all "video editing" courses), and add fuzzy matching (fuse.js / rapidfuzz) to handle typos.
4. Need it built for you?
Don't have a developer? We can build your integration API (product search endpoint) for you and connect it to your assistant.
Tell us your website/data source and what the bot should answer, and we'll set it up.