Skip to content

Commit

Permalink
feat: add lark notification support
Browse files Browse the repository at this point in the history
Signed-off-by: Zufar Dhiyaullhaq <[email protected]>
  • Loading branch information
zufardhiyaulhaq committed Oct 9, 2024
1 parent bca3b7d commit d2a4b24
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions services/notification/lark/lark.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ type Lark struct {

func (s Lark) Send(ctx context.Context, upgrade types.Notification) error {
bot := golark.NewNotificationBot(s.Settings.NotificationLarkWebhook)
_, err := bot.GetTenantAccessTokenInternal(true)
if err != nil {
log.Printf("failed to get tenant access token internal lark: %v\n", err.Error())
return err
}

content := golark.NewPostBuilder().
Title(upgrade.Title).
TextTag(upgrade.Message, 1, true).
Render()
buffer := golark.NewMsgBuffer(golark.MsgPost).Post(content).Build()

_, err = bot.PostMessage(buffer)
_, err := bot.PostNotificationV2(buffer)
if err != nil {
log.Printf("failed to send lark notification: %v\n", err.Error())
return err
Expand Down

0 comments on commit d2a4b24

Please sign in to comment.