{"id":13414029,"url":"https://github.com/go-lark/lark","last_synced_at":"2026-01-17T12:48:32.504Z","repository":{"id":38245134,"uuid":"359802027","full_name":"go-lark/lark","owner":"go-lark","description":"An easy-to-use SDK for Feishu and Lark Open Platform (Instant Messaging API only)","archived":false,"fork":false,"pushed_at":"2025-06-13T03:59:15.000Z","size":236,"stargazers_count":227,"open_issues_count":6,"forks_count":33,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T21:38:19.071Z","etag":null,"topics":["chat-bot","feishu","feishu-sdk","lark-api","lark-sdk","larksuite"],"latest_commit_sha":null,"homepage":"https://go-lark.github.io/","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/go-lark.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":"https://www.buymeacoffee.com/crispgm"}},"created_at":"2021-04-20T12:09:03.000Z","updated_at":"2025-08-08T15:31:24.000Z","dependencies_parsed_at":"2023-11-29T05:21:00.176Z","dependency_job_id":"b8cbdd2e-6a64-478e-9014-e5bac22d23f5","html_url":"https://github.com/go-lark/lark","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/go-lark/lark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-lark%2Flark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-lark%2Flark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-lark%2Flark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-lark%2Flark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-lark","download_url":"https://codeload.github.com/go-lark/lark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-lark%2Flark/sbom","scorecard":{"id":432091,"data":{"date":"2025-08-11","repo":{"name":"github.com/go-lark/lark","commit":"86cd2c2dae2e16ad96b8cd9a7ab54fef005975fe"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Maintained","score":10,"reason":"16 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":2,"reason":"Found 6/24 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build_v1.yml:1","Warn: no topLevel permission defined: .github/workflows/build_v2.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_v1.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v1.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_v1.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v1.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_v1.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v1.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_v1.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v1.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_v1.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v1.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_v2.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v2.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_v2.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v2.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_v2.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v2.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_v2.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v2.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_v2.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/go-lark/lark/build_v2.yml/main?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0603 / GHSA-hp87-p4gw-j4gq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T03:36:49.096Z","repository_id":38245134,"created_at":"2025-08-19T03:36:49.096Z","updated_at":"2025-08-19T03:36:49.096Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chat-bot","feishu","feishu-sdk","lark-api","lark-sdk","larksuite"],"created_at":"2024-07-30T20:01:55.724Z","updated_at":"2026-01-17T12:48:32.490Z","avatar_url":"https://github.com/go-lark.png","language":"Go","funding_links":["https://www.buymeacoffee.com/crispgm"],"categories":["Third-party APIs","Libraries","Go","SDK","第三方api","社区资源","Utility"],"sub_categories":["Utility/Miscellaneous","SDK","Fail injection","实用程序/Miscellaneous"],"readme":"# go-lark\n\n[![build_v1](https://github.com/go-lark/lark/actions/workflows/build_v1.yml/badge.svg)](https://github.com/go-lark/lark/actions/workflows/build_v1.yml)\n[![codecov](https://codecov.io/gh/go-lark/lark/branch/main/graph/badge.svg)](https://codecov.io/gh/go-lark/lark)\n[![Go Report Card](https://goreportcard.com/badge/github.com/go-lark/lark)](https://goreportcard.com/report/github.com/go-lark/lark)\n[![Go Module](https://badge.fury.io/go/github.com%2Fgo-lark%2Flark.svg)](https://badge.fury.io/go/github.com%2Fgo-lark%2Flark.svg)\n[![Go Reference](https://pkg.go.dev/badge/github.com/go-lark/lark.svg)](https://pkg.go.dev/github.com/go-lark/lark)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\n[简体中文](/README_zhCN.md)\n\ngo-lark is an easy-to-use SDK for Feishu and Lark Open Platform,\nwhich implements messaging APIs, with full-fledged supports on building Chat Bot and Notification Bot.\n\nIt is widely used and tested by ~650 ByteDance in-house developers with over 3k Go packages.\n\n## Features\n\n- Notification bot \u0026 chat bot supported\n- Send messages (Group, Private, Rich Text, and Card)\n- Quick to build message with `MsgBuffer`\n- Easy to create incoming message hook\n- Encryption and token verification supported\n- Middleware support for Gin \u0026 Hertz web framework\n- Highly extensible\n- Documentation \u0026 tests\n\n## Installation\n\n```shell\ngo get github.com/go-lark/lark\n```\n\n## Quick Start\n\n### Prerequisite\n\nThere are two types of bot that is supported by go-lark. We need to create a bot manually.\n\nChat Bot:\n\n- Feishu: create from [Feishu Open Platform](https://open.feishu.cn/).\n- Lark: create from [Lark Developer](https://open.larksuite.com/).\n- App ID and App Secret are required to init a `ChatBot`.\n\nNotification Bot:\n\n- Create from group chat.\n- Web Hook URL is required.\n\n### Sending Message\n\nChat Bot:\n\n```go\nimport \"github.com/go-lark/lark\"\n\nfunc main() {\n    bot := lark.NewChatBot(\"\u003cApp ID\u003e\", \"\u003cApp Secret\u003e\")\n    bot.StartHeartbeat()\n    bot.PostText(\"hello, world\", lark.WithEmail(\"someone@example.com\"))\n}\n```\n\nNotification Bot:\n\n```go\nimport \"github.com/go-lark/lark\"\n\nfunc main() {\n    bot := lark.NewNotificationBot(\"\u003cWEB HOOK URL\u003e\")\n    bot.PostNotificationV2(lark.NewMsgBuffer(lark.MsgText).Text(\"hello, world\").Build())\n}\n```\n\nFeishu/Lark API offers more features, please refers to [Usage](#usage) for further documentation.\n\n## Limits\n\n- go-lark is tested on Feishu endpoints, which literally compats Lark endpoints,\n  because Feishu and Lark basically shares the same API specification.\n  We do not guarantee all of the APIs work well with Lark, until we have tested it on Lark.\n- go-lark only supports Custom App. Marketplace App is not supported yet.\n- go-lark implements messaging, group chat, and bot API, other APIs such as Lark Doc, Calendar and so on are not supported.\n\n### Switch to Lark Endpoints\n\nThe default API endpoints are for Feishu, in order to switch to Lark, we should use `SetDomain`:\n\n```go\nbot := lark.NewChatBot(\"\u003cApp ID\u003e\", \"\u003cApp Secret\u003e\")\nbot.SetDomain(lark.DomainLark)\n```\n\n## Usage\n\n### Auth\n\nAuto-renewable authentication:\n\n```go\n// initialize a chat bot with appID and appSecret\nbot := lark.NewChatBot(appID, appSecret)\n// Renew access token periodically\nbot.StartHeartbeat()\n// Stop renewal\nbot.StopHeartbeat()\n```\n\nSingle-pass authentication:\n\n```go\nbot := lark.NewChatBot(appID, appSecret)\nresp, err := bot.GetTenantAccessTokenInternal(true)\n// and we can now access the token value with `bot.TenantAccessToken()`\n```\n\nExample: [examples/auth](https://github.com/go-lark/examples/tree/main/auth)\n\n### Messaging\n\nFor Chat Bot, we can send simple messages with the following method:\n\n- `PostText`\n- `PostTextMention`\n- `PostTextMentionAll`\n- `PostImage`\n- `PostShareChatCard`\n- `ReplyMessage`\n- `AddReaction`\n- `DeleteReaction`\n\nBasic message examples: [examples/basic-message](https://github.com/go-lark/examples/tree/main/basic-message)\n\nTo build rich messages, we may use [Message Buffer](#message-buffer) (or simply `MsgBuffer`),\nwhich builds message conveniently with chaining methods.\n\n### Examples\n\nApart from the general auth and messaging chapter, there are comprehensive examples for almost all APIs.\nHere is a collection of ready-to-run examples for each part of `go-lark`:\n\n- [examples/auth](https://github.com/go-lark/examples/tree/main/auth)\n- [examples/basic-message](https://github.com/go-lark/examples/tree/main/basic-message)\n- [examples/rich-text-message](https://github.com/go-lark/examples/tree/main/rich-text-message)\n- [examples/interactive-message](https://github.com/go-lark/examples/tree/main/interactive-message)\n- [examples/image-message](https://github.com/go-lark/examples/tree/main/image-message)\n- [examples/share-chat](https://github.com/go-lark/examples/tree/main/share-chat)\n- [examples/group](https://github.com/go-lark/examples/tree/main/group)\n\n### Message Buffer\n\nWe can build message body with `MsgBuffer` and send with `PostMessage`, which supports the following message types:\n\n- `MsgText`: Text\n- `MsgPost`: Rich Text\n- `MsgInteractive`: Interactive Card\n- `MsgShareCard`: Group Share Card\n- `MsgShareUser`: User Share Card\n- `MsgImage`: Image\n- `MsgFile`: File\n- `MsgAudio`: Audio\n- `MsgMedia`: Media\n- `MsgSticker`: Sticker\n\n`MsgBuffer` provides binding functions and content functions.\n\nBinding functions:\n\n| Function    | Usage               | Comment                                                                     |\n| ----------- | ------------------- | --------------------------------------------------------------------------- |\n| BindChatID  | Bind a chat ID      | Either `OpenID`, `UserID`, `Email`, `ChatID` or `UnionID` should be present |\n| BindOpenID  | Bind a user open ID |                                                                             |\n| BindUserID  | Bind a user ID      |                                                                             |\n| BindUnionID | Bind a union ID     |                                                                             |\n| BindEmail   | Bind a user email   |                                                                             |\n| BindReply   | Bind a reply ID     | Required when reply a message                                               |\n\nContent functions pair with message content types. If it mismatched, it would not have sent successfully.\nContent functions:\n\n| Function  | Message Type     | Usage                   | Comment                                                          |\n| --------- | ---------------- | ----------------------- | ---------------------------------------------------------------- |\n| Text      | `MsgText`        | Append plain text       | May build with `TextBuilder`                                     |\n| Post      | `MsgPost`        | Append rich text        | May build with `PostBuilder`                                     |\n| Card      | `MsgInteractive` | Append interactive card | May build with [`CardBuilder`](card/README.md)                   |\n| Template  | `MsgInteractive` | Append card template    | Required to build with [CardKit](https://open.feishu.cn/cardkit) |\n| ShareChat | `MsgShareCard`   | Append group share card |                                                                  |\n| ShareUser | `MsgShareUser`   | Append user share card  |                                                                  |\n| Image     | `MsgImage`       | Append image            | Required to upload to Lark server in advance                     |\n| File      | `MsgFile`        | Append file             | Required to upload to Lark server in advance                     |\n| Audio     | `MsgAudio`       | Append audio            | Required to upload to Lark server in advance                     |\n| Media     | `MsgMedia`       | Append media            | Required to upload to Lark server in advance                     |\n| Sticker   | `MsgSticker`     | Append sticker          | Required to upload to Lark server in advance                     |\n\n### Error Handling\n\nEach `go-lark` API function returns `response` and `err`.\n`err` is the error from HTTP client, when it was not `nil`, HTTP might have gone wrong.\n\nWhile `response` is HTTP response from Lark API server, in which `Code` and `OK` represent whether it succeeds.\nThe meaning of `Code` is defined [here](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).\n\n### Event\n\nLark provides a number of [events](https://open.feishu.cn/document/ukTMukTMukTM/uUTNz4SN1MjL1UzM) and they are in two different schema (1.0/2.0).\ngo-lark now only implements a few of them, which are needed for interacting between bot and Lark server:\n\n- URL Challenge\n- Receiving Messages\n\nWe recommend HTTP middlewares to handle these events.\n\n### Middlewares\n\nWe have already implemented HTTP middlewares to support event handling:\n\n- [Gin Middleware](https://github.com/go-lark/lark-gin)\n- [Hertz Middleware](https://github.com/go-lark/lark-hertz)\n\nExample: [examples/gin-middleware](https://github.com/go-lark/examples/tree/main/gin-middleware) [examples/hertz-middleware](https://github.com/go-lark/examples/tree/main/hertz-middleware)\n\n#### URL Challenge\n\n```go\nr := gin.Default()\nmiddleware := larkgin.NewLarkMiddleware()\nmiddleware.BindURLPrefix(\"/handle\") // supposed URL is http://your.domain.com/handle\nr.Use(middleware.LarkChallengeHandler())\n```\n\n#### Event V2\n\nLark has provided event v2 and it applied automatically to newly created bots.\n\n```go\nr := gin.Default()\nmiddleware := larkgin.NewLarkMiddleware()\nr.Use(middleware.LarkEventHandler())\n```\n\nGet the event (e.g. Message):\n\n```go\nr.POST(\"/\", func(c *gin.Context) {\n    if evt, ok := middleware.GetEvent(c); ok { // =\u003e GetEvent instead of GetMessage\n        if evt.Header.EventType == lark.EventTypeMessageReceived {\n            if msg, err := evt.GetMessageReceived(); err == nil {\n                fmt.Println(msg.Message.Content)\n            }\n        }\n    }\n})\n```\n\n#### Card Callback\n\nWe may also setup callback for card actions (e.g. button). The URL challenge part is the same.\n\nWe may use `LarkCardHandler` to handle the actions:\n\n```go\nr.Use(middleware.LarkCardHandler())\nr.POST(\"/callback\", func(c *gin.Context) {\n    if card, ok := middleware.GetCardCallback(c); ok {\n    }\n})\n```\n\n#### Receiving Message (Event V1)\n\nFor older bots, please use v1:\n\n```go\nr := gin.Default()\nmiddleware := larkgin.NewLarkMiddleware()\nmiddleware.BindURLPrefix(\"/handle\") // supposed URL is http://your.domain.com/handle\nr.POST(\"/handle\", func(c *gin.Context) {\n    if msg, ok := middleware.GetMessage(c); ok \u0026\u0026 msg != nil {\n        text := msg.Event.Text\n        // your awesome logic\n    }\n})\n```\n\n### Security \u0026 Encryption\n\nLark Open Platform offers AES encryption and token verification to ensure security for events.\n\n- AES Encryption: when switch on, all traffic will be encrypted with AES.\n- Token Verification: simple token verification for incoming messages.\n\nWe recommend you to enable token verification. If HTTPS is not available on your host, then enable AES encryption.\n\n```go\nmiddleware.WithTokenVerfication(\"\u003cverification-token\u003e\")\nmiddleware.WithEncryption(\"\u003cencryption-key\u003e\")\n```\n\n### Debugging\n\nLark does not provide messaging API debugger officially. Thus, we have to debug with real Lark conversation.\nWe recommend [ngrok](https://ngrok.com/) to debug events.\n\nAnd we add `PostEvent` to simulate message sending to make it even easier.\n`PostEvent` can also be used to redirect events, which acts like a reverse proxy.\n\n## Development\n\n### Test\n\n1. Dotenv Setup\n\n   go-lark uses `godotenv` test locally. You may have to create a `.env` file in repo directory, which contains environmental variables:\n\n   ```bash\n   LARK_APP_ID\n   LARK_APP_SECRET\n   LARK_USER_EMAIL\n   LARK_USER_ID\n   LARK_UNION_ID\n   LARK_OPEN_ID\n   LARK_CHAT_ID\n   LARK_WEBHOOK_V2\n   LARK_WEBHOOK_V2_SIGNED\n   ```\n\n   `LARK_APP_ID` and `LARK_APP_SECRET` are mandatory. Others are required only by specific API tests.\n\n2. Run Test\n\n   ```bash\n   GO_LARK_TEST_MODE=local ./scripts/test.sh\n   ```\n\n### Extensions\n\ngo-lark's dev utilities (authentication, HTTP handling, and etc.) are capable for easily implementing most of APIs provided by Lark Open Platform.\nAnd we may use that as an extension for go-lark.\n\nHere is an example that implementing a Lark Doc API with go-lark:\n\n```go\npackage lark\n\nimport \"github.com/go-lark/lark\"\n\nconst copyFileAPIPattern = \"/open-apis/drive/explorer/v2/file/copy/files/%s\"\n\n// CopyFileResponse .\ntype CopyFileResponse struct {\n\tlark.BaseResponse\n\n\tData CopyFileData `json:\"data\"`\n}\n\n// CopyFileData .\ntype CopyFileData struct {\n\tFolderToken string `json:\"folderToken\"`\n\tRevision    int64  `json:\"revision\"`\n\tToken       string `json:\"token\"`\n\tType        string `json:\"type\"`\n\tURL         string `json:\"url\"`\n}\n\n// CopyFile implementation\nfunc CopyFile(bot *lark.Bot, fileToken, dstFolderToken, dstName string) (*CopyFileResponse, error) {\n\tvar respData model.CopyFileResponse\n\terr := bot.PostAPIRequest(\n\t\t\"CopyFile\",\n\t\tfmt.Sprintf(copyFileAPIPattern, fileToken),\n\t\ttrue,\n\t\tmap[string]interface{}{\n\t\t\t\"type\":             \"doc\",\n\t\t\t\"dstFolderToken\":   dstFolderToken,\n\t\t\t\"dstName\":          dstName,\n\t\t\t\"permissionNeeded\": true,\n\t\t\t\"CommentNeeded\":    false,\n\t\t},\n\t\t\u0026respData,\n\t)\n\treturn \u0026respData, err\n}\n```\n\n## FAQ\n\n- I got `99991401` when sending messages\n  - remove IP Whitelist from dashboard\n- My bot failed sending messages\n  1. check authentication.\n  2. not invite to the group.\n  3. API permission not applied.\n- Does go-lark support interactive message card?\n  - Yes, use a CardBuilder.\n\n## Contributing\n\n- If you think you've found a bug with go-lark, please file an issue.\n- Pull Request is welcomed.\n\n## License\n\nCopyright (c) David Zhang, 2018-2024. Licensed under MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-lark%2Flark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-lark%2Flark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-lark%2Flark/lists"}