Full MTProto 2.0
Every one of the 781 API methods is generated with embedded official docs. Call any of them directly through
client.API().Batteries included
Fast and lightweight
- ~150 KB per idle client
- No runtime reflection
- Thousands of concurrent clients
Robust
- Automatic reconnects and DC migration
- Update recovery engine
- Rigorously tested against real servers
Secure and capable
- Follows Telegram security guidelines
- MTProxy, WebSocket, WASM
- Voice and video calls
Connect in a few lines
package main
import (
"context"
"github.com/gotd/td/telegram"
)
func main() {
// Get api_id and api_hash from https://my.telegram.org/apps.
client := telegram.NewClient(appID, appHash, telegram.Options{})
if err := client.Run(context.Background(), func(ctx context.Context) error {
// The client is connected only while this function runs.
api := client.API()
// Call any of the 781 MTProto methods directly.
dc, err := api.HelpGetNearestDC(ctx)
if err != nil {
return err
}
_ = dc
return nil
}); err != nil {
panic(err)
}
}
See the first-client guide and echo bot tutorial to go further.