Building a Lark Notification Plugin for Apache Answer

Plugin Architecture

The Answer project, an open-source Q&A platform under the Apache Foundation, supports extensibility through plugins. I contributed the Lark (Feishu) notification plugin to deliver real-time alerts for new questions and answers.

The design follows these principles:

  • A Lark bot is created within a team, and its webhook endpoint is configured in the backend.
  • When new questions or answers appear, the plugin sends card-style messages to users via the bot.

The plugin impleemnts the Notification interface defined by Answer:

type Notification interface {
    GetNewQuestionSubscribers() (userIDs []string)
    Notify(msg NotificationMessage)
}

Binding Flow

graph LR
    LarkUser -- Menu --> LarkBot -- OpenID --> Answer

Notification Flow

graph LR
    Inbox -- HTTP --> LarkBot -- Message --> User
    AllNewQuestions -- HTTP --> LarkBot
    FollowedTagQuestions -- HTTP --> LarkBot

Configuration Items

System-level configuration

Key Type Description
App ID string Lark bot Application ID
App Secret string Lark bot Application Secret

User-level configuration

Key Type Description
Lark User ID string OpenID of the Lark user
Inbox notifications bool Enable inbox notifications
New question notifications bool Enable new question alerts
Followed tag notifications bool Enable alerts for followed tags

Required Permissions

Permission ID Name Description
im:message.p2p_msg:readonly Read one-on-one messages Receive direct messages from users to the bot

Events to Subscribe

Event ID Name Description
application.bot.menu_v6 Bot custom meenu event Handle buttton clicks

Creating the Plugin

  1. Register a Lark bot following the official documentation.
  2. Create the plugin structure using Answer’s plugin guidelines.
  3. Ensure consistent package naming across three locations:
// cmd/answer/main.go
import (
    _ "github.com/apache/incubator-answer-plugins/notification-lark" // import plugin
    answercmd "github.com/apache/incubator-answer/cmd"
)
// ui/src/plugins/notification-lark/go.mod
module github.com/apache/incubator-answer-plugins/notification-lark
// go.mod
replace github.com/apache/incubator-answer-plugins/notification-lark => ./ui/src/plugins/notification-lark

Integrating with Lark API

The plugin connects to Lark's Open Platform to send card messages. It uses the bot's credentials (App ID and App Secret) to obtain an access token, then calls the messaging API to push notifications to individual users or broadcast to all subscribers.

Tags: Apache Answer Lark Feishu plugin notification

Posted on Mon, 14 Sep 2026 16:52:01 +0000 by JamesyBHOY