go-lark

build codecov Go Report Card Go Reference Mentioned in Awesome Go

An easy-to-use unofficial SDK for Feishu and Lark Open Platform.

go-lark implements messaging APIs, with full-fledged supports on building Chat Bot and Notification Bot.

It is widely used and tested by in-house ~450 developers with over 1.5k Go packages.

Features

Installation

go get github.com/go-lark/lark

Quick Start

Prerequisite

There are two types of bot that is supported by go-lark. We need to create a bot manually.

Chat Bot:

Notification Bot:

Sending Message

Chat Bot:

import "github.com/go-lark/lark"

func main() {
    bot := lark.NewChatBot("<App ID>", "<App Secret>")
    bot.StartHeartbeat()
    bot.PostText("hello, world", lark.WithEmail("someone@example.com"))
}

Notification Bot:

import "github.com/go-lark/lark"

func main() {
    bot := lark.NewNotificationBot("<WEB HOOK URL>")
    bot.PostNotification("title", "text")
}

Limits

Switch to Lark Endpoints

The default API endpoints are for Feishu, in order to switch to Lark, we should use SetDomain:

bot := lark.NewChatBot("<App ID>", "<App Secret>")
bot.SetDomain(lark.DomainLark)

Documentation

See full documentation on README.