Luna is a Go library that makes it easy to build custom Facebook Messenger clients. It's a simplified wrapper around the mautrix-meta messagix library, handling all the messy details of Meta's reverse-engineered protocols so you can focus on building your app.
To see Luna in action, you can run the included CLI tool:
# Build the example
go build -o luna-cli ./cmd/luna
# Run it
./luna-cliThe first time you run it, it'll walk you through a native login flow (just like the Messenger Lite app). It saves your session to luna.db so you don't have to log in every time.
- Native Login: Log in with just your username and password. No need to hunt for browser cookies. Note: Two-Factor Authentication (2FA) must be enabled on your account for this method to work.
- Persistence: Sessions are automatically managed and stored in SQLite.
- Simple Events: Hook into messages, reactions, and connection status changes with a single callback.
- Clean API: We've abstracted away the "LightSpeed" tables and MQTT complexity into a clean, Go-idiomatic interface.
Under the hood, Luna uses pkg/messagix to talk to Meta's servers. This involves emulating a Messenger Lite device, interpreting "Bloks" scripts (Meta's server-driven UI), and maintaining a persistent MQTT connection for real-time updates. Luna takes all those moving parts and provides a stable Client interface.
MIT