The Telegram MTProto library for Go.
gogram is a complete Telegram client written in pure Go. Build bots, automate accounts, mirror channels, run userbots, ship anything Telegram can do — without leaving the language.
package main
import (
"github.com/amarnathcjd/gogram/telegram"
)
func main() {
client, _ := telegram.NewClient(telegram.ClientConfig{
AppID: 123456,
AppHash: "your-app-hash",
Session: "session.dat",
})
if err := client.Connect(); err != nil {
panic(err)
}
client.LoginBot("123:abc")
client.SendMessage("me", "hello from gogram")
}package main
import (
"github.com/amarnathcjd/gogram/telegram"
)
func main() {
client, _ := telegram.NewClient(telegram.ClientConfig{
AppID: 123456,
AppHash: "your-app-hash",
Session: "session.dat",
})
if err := client.Connect(); err != nil {
panic(err)
}
client.LoginBot("123:abc")
client.SendMessage("me", "hello from gogram")
}A complete client. Not a wrapper.
Everything below is real, shipping today. Nothing you have to bring yourself.
Pure MTProto
Speaks Telegram's real protocol over TCP or WebSocket. No HTTP Bot API, no hidden HTTP hops, no leaky abstractions.
Bots and users
Same client, same surface. Log in with a token, phone, or QR.
Updates dispatcher
Type-safe handlers. Filters. Middleware. Conversations. All in one dispatcher.
Five data centres
Automatic DC migration. Persistent per-DC senders for parallel file transfer.
Real performance
Parallel exported senders. Auto-reconnect. Flood-wait handling. DC migration baked in.
Portable sessions
File, base64 string, in-memory, or AES-encrypted. Move between hosts freely.
Pick a lane, get the call.
client.LoginBot(token)A single API call. BotFather issues the token, gogram calls auth.importBotAuthorization, and the session file caches the auth key for every subsequent run.
Bot login docsWhere to start.
What gogram is and how the pieces fit together.
Echo bot running in under five minutes.
Every field, what it does, when to set it.
File, string, in-memory, encrypted. Pick one.
Text, media, albums, polls, reactions.
HTML, Markdown, entities, RichBuilder.
Wire handlers to updates with filters.
Direct access to every TL method.
More than docs.
This site bundles the live TL schema reference for layer 227, every RPC error gogram knows about with hand-written explanations, and a browser-based tools that benchmarks Telegram's data centres in WebAssembly.
