{"id":36496380,"url":"https://github.com/nduyhai/go-zalo-bot-api","last_synced_at":"2026-01-15T02:18:50.890Z","repository":{"id":332000530,"uuid":"1072975673","full_name":"nduyhai/go-zalo-bot-api","owner":"nduyhai","description":"Go client for the Zalo Bot API","archived":false,"fork":false,"pushed_at":"2025-10-19T10:06:28.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T04:12:39.377Z","etag":null,"topics":["bot","zalo"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nduyhai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-09T13:13:41.000Z","updated_at":"2025-10-19T10:06:31.000Z","dependencies_parsed_at":"2026-01-12T04:12:41.776Z","dependency_job_id":null,"html_url":"https://github.com/nduyhai/go-zalo-bot-api","commit_stats":null,"previous_names":["nduyhai/go-zalo-bot-api"],"tags_count":4,"template":false,"template_full_name":"nduyhai/go-module","purl":"pkg:github/nduyhai/go-zalo-bot-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nduyhai%2Fgo-zalo-bot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nduyhai%2Fgo-zalo-bot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nduyhai%2Fgo-zalo-bot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nduyhai%2Fgo-zalo-bot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nduyhai","download_url":"https://codeload.github.com/nduyhai/go-zalo-bot-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nduyhai%2Fgo-zalo-bot-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","zalo"],"created_at":"2026-01-12T02:01:59.169Z","updated_at":"2026-01-15T02:18:50.884Z","avatar_url":"https://github.com/nduyhai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-zalo-bot-api\n\nA batteries-included Go client for the [Zalo Bot API](https://bot.zapps.me/docs). It wraps the HTTP endpoints with typed request/response models, retry-aware transports, and ergonomic helpers so you can focus on your bot logic instead of wiring.\n\n## Features\n\n- ✅ Lightweight, concurrency-safe `Client` abstraction with configurable base URL, custom HTTP client, and user agent.\n- ✅ Ready-made endpoint helpers for common actions (get bot info, manage webhooks, send messages, stickers, and chat actions).\n- ✅ Iterator-based long-polling helper that smooths over pagination and transient failures.\n- ✅ Pluggable logging interface with structured logging support out of the box.\n\n## Installation\n\n```bash\ngo get github.com/nduyhai/go-zalo-bot-api\n```\n\n## Quick start\n\nCreate a client with your bot token and call any endpoint helper. Each request accepts per-call options such as timeouts so you can control retry and cancellation behaviour.\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log/slog\"\n    \"time\"\n\n    zalobotapi \"github.com/nduyhai/go-zalo-bot-api\"\n    \"github.com/nduyhai/go-zalo-bot-api/endpoints\"\n)\n\nfunc main() {\n    botToken := \"\u003cyour bot token\u003e\"\n    chatID := \"\u003cchat id\u003e\"\n\n    logger := zalobotapi.NewSlogLogger(slog.Default())\n    client := zalobotapi.New(botToken,\n        zalobotapi.WithLogger(logger),\n        zalobotapi.WithUserAgent(\"my-bot/1.0\"),\n    )\n\n    ctx := context.Background()\n\n    // Call any endpoint helper. This example sends a message with a per-call timeout.\n    _, err := endpoints.SendMessage(ctx, client, endpoints.SendMessageReq{\n        ChatID: chatID,\n        Text:   \"Xin chào từ go-zalo-bot-api!\",\n    }, zalobotapi.WithTimeout(5*time.Second))\n    if err != nil {\n        logger.Error(\"send message\", map[string]any{\"err\": err})\n    }\n}\n```\n\nLooking for a more complete example (with retries, custom transports, and long-polling for updates)? Check out [`cmd/example/main.go`](cmd/example/main.go).\n\n## Environment variables\n\nThe example program expects:\n\n- `BOT_TOKEN` – the access token of your Official Account bot.\n- `CHAT_ID` – the identifier of the conversation you want to send messages to.\n\nYou can use a `.env` file together with [`godotenv`](https://github.com/joho/godotenv) to load these values during development.\n\n## Development\n\n1. Export the required environment variables (or create a `.env` file) with values for `BOT_TOKEN` and `CHAT_ID`.\n2. Run the example bot:\n   ```bash\n   make run\n   ```\n   This executes `go run ./cmd/example` so you can verify connectivity and explore the iterator-based long-polling helpers.\n\n## License\n\nDistributed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnduyhai%2Fgo-zalo-bot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnduyhai%2Fgo-zalo-bot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnduyhai%2Fgo-zalo-bot-api/lists"}