Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support teams direct message (#18300)

ecmadao092c4ac2a8e6
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 4c9c1a43e9..004615ecc7 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -23,6 +23,7 @@ import (
"github.com/bytebase/bytebase/backend/plugin/webhook/feishu"
"github.com/bytebase/bytebase/backend/plugin/webhook/lark"
"github.com/bytebase/bytebase/backend/plugin/webhook/slack"
+ "github.com/bytebase/bytebase/backend/plugin/webhook/teams"
"github.com/bytebase/bytebase/backend/plugin/webhook/wecom"
"github.com/bytebase/bytebase/backend/store"
)
@@ -401,6 +402,15 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Req
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("validation failed, error: %v", err))
}
+ case "value.app_im_setting_value.teams":
+ teamsSetting := findIMSetting(storepb.ProjectWebhook_TEAMS)
+ if teamsSetting == nil || teamsSetting.GetTeams() == nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.New("cannot found teams setting"))
+ }
+ if err := teams.Validate(ctx, teamsSetting.GetTeams().GetTenantId(), teamsSetting.GetTeams().GetClientId(), teamsSetting.GetTeams().GetClientSecret(), user.Email); err != nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("validation failed, error: %v", err))
+ }
+
default:
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid update mask path %v", path))
}
diff --git a/backend/api/v1/setting_service_converter.go b/backend/api/v1/setting_service_converter.go
index f141bb58b8..16515006cc 100644
--- a/backend/api/v1/setting_service_converter.go
+++ b/backend/api/v1/setting_service_converter.go
@@ -401,45 +401,55 @@ func convertAppIMSetting(v1Setting *v1pb.AppIMSetting) (*storepb.AppIMSetting, e
imSetting := &storepb.AppIMSetting_IMSetting{
Type: storepb.ProjectWebhook_Type(setting.Type),
}
- switch payload := setting.Payload.(type) {
- case *v1pb.AppIMSetting_IMSetting_Slack:
+ // Handle based on Type field since protobuf-es may serialize oneof incorrectly.
+ // The oneof payload type may not match the Type field due to serialization issues.
+ switch setting.Type {
+ case v1pb.Webhook_SLACK:
imSetting.Payload = &storepb.AppIMSetting_IMSetting_Slack{
Slack: &storepb.AppIMSetting_Slack{
- Token: payload.Slack.Token,
+ Token: setting.GetSlack().GetToken(),
},
}
- case *v1pb.AppIMSetting_IMSetting_Feishu:
+ case v1pb.Webhook_FEISHU:
imSetting.Payload = &storepb.AppIMSetting_IMSetting_Feishu{
Feishu: &storepb.AppIMSetting_Feishu{
- AppId: payload.Feishu.AppId,
- AppSecret: payload.Feishu.AppSecret,
+ AppId: setting.GetFeishu().GetAppId(),
+ AppSecret: setting.GetFeishu().GetAppSecret(),
},
}
- case *v1pb.AppIMSetting_IMSetting_Wecom:
+ case v1pb.Webhook_WECOM:
imSetting.Payload = &storepb.AppIMSetting_IMSetting_Wecom{
Wecom: &storepb.AppIMSetting_Wecom{
- CorpId: payload.Wecom.CorpId,
- AgentId: payload.Wecom.AgentId,
- Secret: payload.Wecom.Secret,
+ CorpId: setting.GetWecom().GetCorpId(),
+ AgentId: setting.GetWecom().GetAgentId(),
+ Secret: setting.GetWecom().GetSecret(),
},
}
- case *v1pb.AppIMSetting_IMSetting_Lark:
+ case v1pb.Webhook_LARK:
imSetting.Payload = &storepb.AppIMSetting_IMSetting_Lark{
Lark: &storepb.AppIMSetting_Lark{
- AppId: payload.Lark.AppId,
- AppSecret: payload.Lark.AppSecret,
+ AppId: setting.GetLark().GetAppId(),
+ AppSecret: setting.GetLark().GetAppSecret(),
},
}
- case *v1pb.AppIMSetting_IMSetting_Dingtalk:
+ case v1pb.Webhook_DINGTALK:
imSetting.Payload = &storepb.AppIMSetting_IMSetting_Dingtalk{
Dingtalk: &storepb.AppIMSetting_DingTalk{
- ClientId: payload.Dingtalk.ClientId,
- ClientSecret: payload.Dingtalk.ClientSecret,
- RobotCode: payload.Dingtalk.RobotCode,
+ ClientId: setting.GetDingtalk().GetClientId(),
+ ClientSecret: setting.GetDingtalk().GetClientSecret(),
+ RobotCode: setting.GetDingtalk().GetRobotCode(),
+ },
+ }
+ case v1pb.Webhook_TEAMS:
+ imSetting.Payload = &storepb.AppIMSetting_IMSetting_Teams{
+ Teams: &storepb.AppIMSetting_Teams{
+ TenantId: setting.GetTeams().GetTenantId(),
+ ClientId: setting.GetTeams().GetClientId(),
+ ClientSecret: setting.GetTeams().GetClientSecret(),
},
}
default:
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unsupport im type %v", setting.Type.String()))
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unsupported im type %v", setting.Type.String()))
}
storeSetting.Settings = append(storeSetting.Settings, imSetting)
}
@@ -478,6 +488,10 @@ func convertToAppIMSetting(storeSetting *storepb.AppIMSetting) *v1pb.AppIMSettin
imSetting.Payload = &v1pb.AppIMSetting_IMSetting_Dingtalk{
Dingtalk: &v1pb.AppIMSetting_DingTalk{},
}
+ case storepb.ProjectWebhook_TEAMS:
+ imSetting.Payload = &v1pb.AppIMSetting_IMSetting_Teams{
+ Teams: &v1pb.AppIMSetting_Teams{},
+ }
default:
}
v1Setting.Settings = append(v1Setting.Settings, imSetting)
diff --git a/backend/generated-go/store/setting.pb.go b/backend/generated-go/store/setting.pb.go
index 6919cfc039..489fbbeeb7 100644
--- a/backend/generated-go/store/setting.pb.go
+++ b/backend/generated-go/store/setting.pb.go
@@ -2029,6 +2029,69 @@ func (x *AppIMSetting_DingTalk) GetRobotCode() string {
return ""
}
+type AppIMSetting_Teams struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Azure AD tenant ID (Directory ID).
+ TenantId string `protobuf:"bytes,1,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"`
+ // Azure AD application (client) ID.
+ ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
+ // Azure AD client secret.
+ ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *AppIMSetting_Teams) Reset() {
+ *x = AppIMSetting_Teams{}
+ mi := &file_store_setting_proto_msgTypes[27]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *AppIMSetting_Teams) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AppIMSetting_Teams) ProtoMessage() {}
+
+func (x *AppIMSetting_Teams) ProtoReflect() protoreflect.Message {
+ mi := &file_store_setting_proto_msgTypes[27]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AppIMSetting_Teams.ProtoReflect.Descriptor instead.
+func (*AppIMSetting_Teams) Descriptor() ([]byte, []int) {
+ return file_store_setting_proto_rawDescGZIP(), []int{6, 5}
+}
+
+func (x *AppIMSetting_Teams) GetTenantId() string {
+ if x != nil {
+ return x.TenantId
+ }
+ return ""
+}
+
+func (x *AppIMSetting_Teams) GetClientId() string {
+ if x != nil {
+ return x.ClientId
+ }
+ return ""
+}
+
+func (x *AppIMSetting_Teams) GetClientSecret() string {
+ if x != nil {
+ return x.ClientSecret
+ }
+ return ""
+}
+
type AppIMSetting_IMSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type ProjectWebhook_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.store.ProjectWebhook_Type" json:"type,omitempty"`
@@ -2039,6 +2102,7 @@ type AppIMSetting_IMSetting struct {
// *AppIMSetting_IMSetting_Wecom
// *AppIMSetting_IMSetting_Lark
// *AppIMSetting_IMSetting_Dingtalk
+ // *AppIMSetting_IMSetting_Teams
Payload isAppIMSetting_IMSetting_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -2046,7 +2110,7 @@ type AppIMSetting_IMSetting struct {
func (x *AppIMSetting_IMSetting) Reset() {
*x = AppIMSetting_IMSetting{}
- mi := &file_store_setting_proto_msgTypes[27]
+ mi := &file_store_setting_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2058,7 +2122,7 @@ func (x *AppIMSetting_IMSetting) String() string {
func (*AppIMSetting_IMSetting) ProtoMessage() {}
func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {
- mi := &file_store_setting_proto_msgTypes[27]
+ mi := &file_store_setting_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2071,7 +2135,7 @@ func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use AppIMSetting_IMSetting.ProtoReflect.Descriptor instead.
func (*AppIMSetting_IMSetting) Descriptor() ([]byte, []int) {
- return file_store_setting_proto_rawDescGZIP(), []int{6, 5}
+ return file_store_setting_proto_rawDescGZIP(), []int{6, 6}
}
func (x *AppIMSetting_IMSetting) GetType() ProjectWebhook_Type {
@@ -2133,6 +2197,15 @@ func (x *AppIMSetting_IMSetting) GetDingtalk() *AppIMSetting_DingTalk {
return nil
}
+func (x *AppIMSetting_IMSetting) GetTeams() *AppIMSetting_Teams {
+ if x != nil {
+ if x, ok := x.Payload.(*AppIMSetting_IMSetting_Teams); ok {
+ return x.Teams
+ }
+ }
+ return nil
+}
+
type isAppIMSetting_IMSetting_Payload interface {
isAppIMSetting_IMSetting_Payload()
}
@@ -2157,6 +2230,10 @@ type AppIMSetting_IMSetting_Dingtalk struct {
Dingtalk *AppIMSetting_DingTalk `protobuf:"bytes,6,opt,name=dingtalk,proto3,oneof"`
}
+type AppIMSetting_IMSetting_Teams struct {
+ Teams *AppIMSetting_Teams `protobuf:"bytes,7,opt,name=teams,proto3,oneof"`
+}
+
func (*AppIMSetting_IMSetting_Slack) isAppIMSetting_IMSetting_Payload() {}
func (*AppIMSetting_IMSetting_Feishu) isAppIMSetting_IMSetting_Payload() {}
@@ -2167,6 +2244,8 @@ func (*AppIMSetting_IMSetting_Lark) isAppIMSetting_IMSetting_Payload() {}
func (*AppIMSetting_IMSetting_Dingtalk) isAppIMSetting_IMSetting_Payload() {}
+func (*AppIMSetting_IMSetting_Teams) isAppIMSetting_IMSetting_Payload() {}
+
type EnvironmentSetting_Environment struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The resource id of the environment.
@@ -2183,7 +2262,7 @@ type EnvironmentSetting_Environment struct {
func (x *EnvironmentSetting_Environment) Reset() {
*x = EnvironmentSetting_Environment{}
- mi := &file_store_setting_proto_msgTypes[28]
+ mi := &file_store_setting_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2195,7 +2274,7 @@ func (x *EnvironmentSetting_Environment) String() string {
func (*EnvironmentSetting_Environment) ProtoMessage() {}
func (x *EnvironmentSetting_Environment) ProtoReflect() protoreflect.Message {
- mi := &file_store_setting_proto_msgTypes[28]
+ mi := &file_store_setting_proto_msgTypes[29]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2337,7 +2416,7 @@ const file_store_setting_proto_rawDesc = "" +
"\x15MASK_TYPE_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05INNER\x10\x01\x12\t\n" +
"\x05OUTER\x10\x02B\x06\n" +
- "\x04mask\"\xb8\x06\n" +
+ "\x04mask\"\xdc\a\n" +
"\fAppIMSetting\x12B\n" +
"\bsettings\x18\x01 \x03(\v2&.bytebase.store.AppIMSetting.IMSettingR\bsettings\x1a\x1d\n" +
"\x05Slack\x12\x14\n" +
@@ -2358,14 +2437,19 @@ const file_store_setting_proto_rawDesc = "" +
"\tclient_id\x18\x01 \x01(\tR\bclientId\x12#\n" +
"\rclient_secret\x18\x02 \x01(\tR\fclientSecret\x12\x1d\n" +
"\n" +
- "robot_code\x18\x03 \x01(\tR\trobotCode\x1a\x84\x03\n" +
+ "robot_code\x18\x03 \x01(\tR\trobotCode\x1af\n" +
+ "\x05Teams\x12\x1b\n" +
+ "\ttenant_id\x18\x01 \x01(\tR\btenantId\x12\x1b\n" +
+ "\tclient_id\x18\x02 \x01(\tR\bclientId\x12#\n" +
+ "\rclient_secret\x18\x03 \x01(\tR\fclientSecret\x1a\xc0\x03\n" +
"\tIMSetting\x127\n" +
"\x04type\x18\x01 \x01(\x0e2#.bytebase.store.ProjectWebhook.TypeR\x04type\x12:\n" +
"\x05slack\x18\x02 \x01(\v2\".bytebase.store.AppIMSetting.SlackH\x00R\x05slack\x12=\n" +
"\x06feishu\x18\x03 \x01(\v2#.bytebase.store.AppIMSetting.FeishuH\x00R\x06feishu\x12:\n" +
"\x05wecom\x18\x04 \x01(\v2\".bytebase.store.AppIMSetting.WecomH\x00R\x05wecom\x127\n" +
"\x04lark\x18\x05 \x01(\v2!.bytebase.store.AppIMSetting.LarkH\x00R\x04lark\x12C\n" +
- "\bdingtalk\x18\x06 \x01(\v2%.bytebase.store.AppIMSetting.DingTalkH\x00R\bdingtalkB\t\n" +
+ "\bdingtalk\x18\x06 \x01(\v2%.bytebase.store.AppIMSetting.DingTalkH\x00R\bdingtalk\x12:\n" +
+ "\x05teams\x18\a \x01(\v2\".bytebase.store.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +
"\apayload\"#\n" +
"\vSCIMSetting\x12\x14\n" +
"\x05token\x18\x01 \x01(\tR\x05token\"\x9a\x03\n" +
@@ -2441,7 +2525,7 @@ func file_store_setting_proto_rawDescGZIP() []byte {
}
var file_store_setting_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
-var file_store_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 30)
+var file_store_setting_proto_msgTypes = make([]protoimpl.MessageInfo, 31)
var file_store_setting_proto_goTypes = []any{
(SettingName)(0), // 0: bytebase.store.SettingName
(DatabaseChangeMode)(0), // 1: bytebase.store.DatabaseChangeMode
@@ -2476,20 +2560,21 @@ var file_store_setting_proto_goTypes = []any{
(*AppIMSetting_Wecom)(nil), // 30: bytebase.store.AppIMSetting.Wecom
(*AppIMSetting_Lark)(nil), // 31: bytebase.store.AppIMSetting.Lark
(*AppIMSetting_DingTalk)(nil), // 32: bytebase.store.AppIMSetting.DingTalk
- (*AppIMSetting_IMSetting)(nil), // 33: bytebase.store.AppIMSetting.IMSetting
- (*EnvironmentSetting_Environment)(nil), // 34: bytebase.store.EnvironmentSetting.Environment
- nil, // 35: bytebase.store.EnvironmentSetting.Environment.TagsEntry
- (*durationpb.Duration)(nil), // 36: google.protobuf.Duration
- (*ApprovalTemplate)(nil), // 37: bytebase.store.ApprovalTemplate
- (*expr.Expr)(nil), // 38: google.type.Expr
- (ProjectWebhook_Type)(0), // 39: bytebase.store.ProjectWebhook.Type
+ (*AppIMSetting_Teams)(nil), // 33: bytebase.store.AppIMSetting.Teams
+ (*AppIMSetting_IMSetting)(nil), // 34: bytebase.store.AppIMSetting.IMSetting
+ (*EnvironmentSetting_Environment)(nil), // 35: bytebase.store.EnvironmentSetting.Environment
+ nil, // 36: bytebase.store.EnvironmentSetting.Environment.TagsEntry
+ (*durationpb.Duration)(nil), // 37: google.protobuf.Duration
+ (*ApprovalTemplate)(nil), // 38: bytebase.store.ApprovalTemplate
+ (*expr.Expr)(nil), // 39: google.type.Expr
+ (ProjectWebhook_Type)(0), // 40: bytebase.store.ProjectWebhook.Type
}
var file_store_setting_proto_depIdxs = []int32{
- 36, // 0: bytebase.store.WorkspaceProfileSetting.token_duration:type_name -> google.protobuf.Duration
+ 37, // 0: bytebase.store.WorkspaceProfileSetting.token_duration:type_name -> google.protobuf.Duration
7, // 1: bytebase.store.WorkspaceProfileSetting.announcement:type_name -> bytebase.store.Announcement
- 36, // 2: bytebase.store.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
+ 37, // 2: bytebase.store.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
1, // 3: bytebase.store.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.store.DatabaseChangeMode
- 36, // 4: bytebase.store.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
+ 37, // 4: bytebase.store.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
2, // 5: bytebase.store.Announcement.level:type_name -> bytebase.store.Announcement.AlertLevel
17, // 6: bytebase.store.WorkspaceApprovalSetting.rules:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule
18, // 7: bytebase.store.DataClassificationSetting.configs:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig
@@ -2498,12 +2583,12 @@ var file_store_setting_proto_depIdxs = []int32{
24, // 10: bytebase.store.Algorithm.range_mask:type_name -> bytebase.store.Algorithm.RangeMask
25, // 11: bytebase.store.Algorithm.md5_mask:type_name -> bytebase.store.Algorithm.MD5Mask
26, // 12: bytebase.store.Algorithm.inner_outer_mask:type_name -> bytebase.store.Algorithm.InnerOuterMask
- 33, // 13: bytebase.store.AppIMSetting.settings:type_name -> bytebase.store.AppIMSetting.IMSetting
- 36, // 14: bytebase.store.PasswordRestrictionSetting.password_rotation:type_name -> google.protobuf.Duration
+ 34, // 13: bytebase.store.AppIMSetting.settings:type_name -> bytebase.store.AppIMSetting.IMSetting
+ 37, // 14: bytebase.store.PasswordRestrictionSetting.password_rotation:type_name -> google.protobuf.Duration
5, // 15: bytebase.store.AISetting.provider:type_name -> bytebase.store.AISetting.Provider
- 34, // 16: bytebase.store.EnvironmentSetting.environments:type_name -> bytebase.store.EnvironmentSetting.Environment
- 37, // 17: bytebase.store.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.store.ApprovalTemplate
- 38, // 18: bytebase.store.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
+ 35, // 16: bytebase.store.EnvironmentSetting.environments:type_name -> bytebase.store.EnvironmentSetting.Environment
+ 38, // 17: bytebase.store.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.store.ApprovalTemplate
+ 39, // 18: bytebase.store.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
3, // 19: bytebase.store.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.store.WorkspaceApprovalSetting.Rule.Source
19, // 20: bytebase.store.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.Level
21, // 21: bytebase.store.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.store.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
@@ -2511,18 +2596,19 @@ var file_store_setting_proto_depIdxs = []int32{
11, // 23: bytebase.store.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.store.Algorithm
27, // 24: bytebase.store.Algorithm.RangeMask.slices:type_name -> bytebase.store.Algorithm.RangeMask.Slice
4, // 25: bytebase.store.Algorithm.InnerOuterMask.type:type_name -> bytebase.store.Algorithm.InnerOuterMask.MaskType
- 39, // 26: bytebase.store.AppIMSetting.IMSetting.type:type_name -> bytebase.store.ProjectWebhook.Type
+ 40, // 26: bytebase.store.AppIMSetting.IMSetting.type:type_name -> bytebase.store.ProjectWebhook.Type
28, // 27: bytebase.store.AppIMSetting.IMSetting.slack:type_name -> bytebase.store.AppIMSetting.Slack
29, // 28: bytebase.store.AppIMSetting.IMSetting.feishu:type_name -> bytebase.store.AppIMSetting.Feishu
30, // 29: bytebase.store.AppIMSetting.IMSetting.wecom:type_name -> bytebase.store.AppIMSetting.Wecom
31, // 30: bytebase.store.AppIMSetting.IMSetting.lark:type_name -> bytebase.store.AppIMSetting.Lark
32, // 31: bytebase.store.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.store.AppIMSetting.DingTalk
- 35, // 32: bytebase.store.EnvironmentSetting.Environment.tags:type_name -> bytebase.store.EnvironmentSetting.Environment.TagsEntry
- 33, // [33:33] is the sub-list for method output_type
- 33, // [33:33] is the sub-list for method input_type
- 33, // [33:33] is the sub-list for extension type_name
- 33, // [33:33] is the sub-list for extension extendee
- 0, // [0:33] is the sub-list for field type_name
+ 33, // 32: bytebase.store.AppIMSetting.IMSetting.teams:type_name -> bytebase.store.AppIMSetting.Teams
+ 36, // 33: bytebase.store.EnvironmentSetting.Environment.tags:type_name -> bytebase.store.EnvironmentSetting.Environment.TagsEntry
+ 34, // [34:34] is the sub-list for method output_type
+ 34, // [34:34] is the sub-list for method input_type
+ 34, // [34:34] is the sub-list for extension type_name
+ 34, // [34:34] is the sub-list for extension extendee
+ 0, // [0:34] is the sub-list for field type_name
}
func init() { file_store_setting_proto_init() }
@@ -2539,12 +2625,13 @@ func file_store_setting_proto_init() {
(*Algorithm_InnerOuterMask_)(nil),
}
file_store_setting_proto_msgTypes[14].OneofWrappers = []any{}
- file_store_setting_proto_msgTypes[27].OneofWrappers = []any{
+ file_store_setting_proto_msgTypes[28].OneofWrappers = []any{
(*AppIMSetting_IMSetting_Slack)(nil),
(*AppIMSetting_IMSetting_Feishu)(nil),
(*AppIMSetting_IMSetting_Wecom)(nil),
(*AppIMSetting_IMSetting_Lark)(nil),
(*AppIMSetting_IMSetting_Dingtalk)(nil),
+ (*AppIMSetting_IMSetting_Teams)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -2552,7 +2639,7 @@ func file_store_setting_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_setting_proto_rawDesc), len(file_store_setting_proto_rawDesc)),
NumEnums: 6,
- NumMessages: 30,
+ NumMessages: 31,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/backend/generated-go/store/setting_equal.pb.go b/backend/generated-go/store/setting_equal.pb.go
index a050a4abcf..e4a822f720 100644
--- a/backend/generated-go/store/setting_equal.pb.go
+++ b/backend/generated-go/store/setting_equal.pb.go
@@ -448,6 +448,25 @@ func (x *AppIMSetting_DingTalk) Equal(y *AppIMSetting_DingTalk) bool {
return true
}
+func (x *AppIMSetting_Teams) Equal(y *AppIMSetting_Teams) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.TenantId != y.TenantId {
+ return false
+ }
+ if x.ClientId != y.ClientId {
+ return false
+ }
+ if x.ClientSecret != y.ClientSecret {
+ return false
+ }
+ return true
+}
+
func (x *AppIMSetting_IMSetting) Equal(y *AppIMSetting_IMSetting) bool {
if x == y {
return true
@@ -473,6 +492,9 @@ func (x *AppIMSetting_IMSetting) Equal(y *AppIMSetting_IMSetting) bool {
if !x.GetDingtalk().Equal(y.GetDingtalk()) {
return false
}
+ if !x.GetTeams().Equal(y.GetTeams()) {
+ return false
+ }
return true
}
diff --git a/backend/generated-go/v1/setting_service.pb.go b/backend/generated-go/v1/setting_service.pb.go
index db4c923375..f7d6d02a2d 100644
--- a/backend/generated-go/v1/setting_service.pb.go
+++ b/backend/generated-go/v1/setting_service.pb.go
@@ -1933,6 +1933,69 @@ func (x *AppIMSetting_DingTalk) GetRobotCode() string {
return ""
}
+type AppIMSetting_Teams struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Azure AD tenant ID (Directory ID).
+ TenantId string `protobuf:"bytes,1,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"`
+ // Azure AD application (client) ID.
+ ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
+ // Azure AD client secret.
+ ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *AppIMSetting_Teams) Reset() {
+ *x = AppIMSetting_Teams{}
+ mi := &file_v1_setting_service_proto_msgTypes[23]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *AppIMSetting_Teams) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*AppIMSetting_Teams) ProtoMessage() {}
+
+func (x *AppIMSetting_Teams) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_setting_service_proto_msgTypes[23]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use AppIMSetting_Teams.ProtoReflect.Descriptor instead.
+func (*AppIMSetting_Teams) Descriptor() ([]byte, []int) {
+ return file_v1_setting_service_proto_rawDescGZIP(), []int{7, 5}
+}
+
+func (x *AppIMSetting_Teams) GetTenantId() string {
+ if x != nil {
+ return x.TenantId
+ }
+ return ""
+}
+
+func (x *AppIMSetting_Teams) GetClientId() string {
+ if x != nil {
+ return x.ClientId
+ }
+ return ""
+}
+
+func (x *AppIMSetting_Teams) GetClientSecret() string {
+ if x != nil {
+ return x.ClientSecret
+ }
+ return ""
+}
+
type AppIMSetting_IMSetting struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type Webhook_Type `protobuf:"varint,1,opt,name=type,proto3,enum=bytebase.v1.Webhook_Type" json:"type,omitempty"`
@@ -1943,6 +2006,7 @@ type AppIMSetting_IMSetting struct {
// *AppIMSetting_IMSetting_Wecom
// *AppIMSetting_IMSetting_Lark
// *AppIMSetting_IMSetting_Dingtalk
+ // *AppIMSetting_IMSetting_Teams
Payload isAppIMSetting_IMSetting_Payload `protobuf_oneof:"payload"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
@@ -1950,7 +2014,7 @@ type AppIMSetting_IMSetting struct {
func (x *AppIMSetting_IMSetting) Reset() {
*x = AppIMSetting_IMSetting{}
- mi := &file_v1_setting_service_proto_msgTypes[23]
+ mi := &file_v1_setting_service_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1962,7 +2026,7 @@ func (x *AppIMSetting_IMSetting) String() string {
func (*AppIMSetting_IMSetting) ProtoMessage() {}
func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[23]
+ mi := &file_v1_setting_service_proto_msgTypes[24]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1975,7 +2039,7 @@ func (x *AppIMSetting_IMSetting) ProtoReflect() protoreflect.Message {
// Deprecated: Use AppIMSetting_IMSetting.ProtoReflect.Descriptor instead.
func (*AppIMSetting_IMSetting) Descriptor() ([]byte, []int) {
- return file_v1_setting_service_proto_rawDescGZIP(), []int{7, 5}
+ return file_v1_setting_service_proto_rawDescGZIP(), []int{7, 6}
}
func (x *AppIMSetting_IMSetting) GetType() Webhook_Type {
@@ -2037,6 +2101,15 @@ func (x *AppIMSetting_IMSetting) GetDingtalk() *AppIMSetting_DingTalk {
return nil
}
+func (x *AppIMSetting_IMSetting) GetTeams() *AppIMSetting_Teams {
+ if x != nil {
+ if x, ok := x.Payload.(*AppIMSetting_IMSetting_Teams); ok {
+ return x.Teams
+ }
+ }
+ return nil
+}
+
type isAppIMSetting_IMSetting_Payload interface {
isAppIMSetting_IMSetting_Payload()
}
@@ -2061,6 +2134,10 @@ type AppIMSetting_IMSetting_Dingtalk struct {
Dingtalk *AppIMSetting_DingTalk `protobuf:"bytes,6,opt,name=dingtalk,proto3,oneof"`
}
+type AppIMSetting_IMSetting_Teams struct {
+ Teams *AppIMSetting_Teams `protobuf:"bytes,7,opt,name=teams,proto3,oneof"`
+}
+
func (*AppIMSetting_IMSetting_Slack) isAppIMSetting_IMSetting_Payload() {}
func (*AppIMSetting_IMSetting_Feishu) isAppIMSetting_IMSetting_Payload() {}
@@ -2071,6 +2148,8 @@ func (*AppIMSetting_IMSetting_Lark) isAppIMSetting_IMSetting_Payload() {}
func (*AppIMSetting_IMSetting_Dingtalk) isAppIMSetting_IMSetting_Payload() {}
+func (*AppIMSetting_IMSetting_Teams) isAppIMSetting_IMSetting_Payload() {}
+
type WorkspaceApprovalSetting_Rule struct {
state protoimpl.MessageState `protogen:"open.v1"`
Template *ApprovalTemplate `protobuf:"bytes,1,opt,name=template,proto3" json:"template,omitempty"`
@@ -2109,7 +2188,7 @@ type WorkspaceApprovalSetting_Rule struct {
func (x *WorkspaceApprovalSetting_Rule) Reset() {
*x = WorkspaceApprovalSetting_Rule{}
- mi := &file_v1_setting_service_proto_msgTypes[24]
+ mi := &file_v1_setting_service_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2121,7 +2200,7 @@ func (x *WorkspaceApprovalSetting_Rule) String() string {
func (*WorkspaceApprovalSetting_Rule) ProtoMessage() {}
func (x *WorkspaceApprovalSetting_Rule) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[24]
+ mi := &file_v1_setting_service_proto_msgTypes[25]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2175,7 +2254,7 @@ type DataClassificationSetting_DataClassificationConfig struct {
func (x *DataClassificationSetting_DataClassificationConfig) Reset() {
*x = DataClassificationSetting_DataClassificationConfig{}
- mi := &file_v1_setting_service_proto_msgTypes[25]
+ mi := &file_v1_setting_service_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2187,7 +2266,7 @@ func (x *DataClassificationSetting_DataClassificationConfig) String() string {
func (*DataClassificationSetting_DataClassificationConfig) ProtoMessage() {}
func (x *DataClassificationSetting_DataClassificationConfig) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[25]
+ mi := &file_v1_setting_service_proto_msgTypes[26]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2242,7 +2321,7 @@ type DataClassificationSetting_DataClassificationConfig_Level struct {
func (x *DataClassificationSetting_DataClassificationConfig_Level) Reset() {
*x = DataClassificationSetting_DataClassificationConfig_Level{}
- mi := &file_v1_setting_service_proto_msgTypes[26]
+ mi := &file_v1_setting_service_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2254,7 +2333,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_Level) String() stri
func (*DataClassificationSetting_DataClassificationConfig_Level) ProtoMessage() {}
func (x *DataClassificationSetting_DataClassificationConfig_Level) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[26]
+ mi := &file_v1_setting_service_proto_msgTypes[27]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2304,7 +2383,7 @@ type DataClassificationSetting_DataClassificationConfig_DataClassification struc
func (x *DataClassificationSetting_DataClassificationConfig_DataClassification) Reset() {
*x = DataClassificationSetting_DataClassificationConfig_DataClassification{}
- mi := &file_v1_setting_service_proto_msgTypes[27]
+ mi := &file_v1_setting_service_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2316,7 +2395,7 @@ func (x *DataClassificationSetting_DataClassificationConfig_DataClassification)
func (*DataClassificationSetting_DataClassificationConfig_DataClassification) ProtoMessage() {}
func (x *DataClassificationSetting_DataClassificationConfig_DataClassification) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[27]
+ mi := &file_v1_setting_service_proto_msgTypes[28]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2377,7 +2456,7 @@ type SemanticTypeSetting_SemanticType struct {
func (x *SemanticTypeSetting_SemanticType) Reset() {
*x = SemanticTypeSetting_SemanticType{}
- mi := &file_v1_setting_service_proto_msgTypes[29]
+ mi := &file_v1_setting_service_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2389,7 +2468,7 @@ func (x *SemanticTypeSetting_SemanticType) String() string {
func (*SemanticTypeSetting_SemanticType) ProtoMessage() {}
func (x *SemanticTypeSetting_SemanticType) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[29]
+ mi := &file_v1_setting_service_proto_msgTypes[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2451,7 +2530,7 @@ type Algorithm_FullMask struct {
func (x *Algorithm_FullMask) Reset() {
*x = Algorithm_FullMask{}
- mi := &file_v1_setting_service_proto_msgTypes[30]
+ mi := &file_v1_setting_service_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2463,7 +2542,7 @@ func (x *Algorithm_FullMask) String() string {
func (*Algorithm_FullMask) ProtoMessage() {}
func (x *Algorithm_FullMask) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[30]
+ mi := &file_v1_setting_service_proto_msgTypes[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2497,7 +2576,7 @@ type Algorithm_RangeMask struct {
func (x *Algorithm_RangeMask) Reset() {
*x = Algorithm_RangeMask{}
- mi := &file_v1_setting_service_proto_msgTypes[31]
+ mi := &file_v1_setting_service_proto_msgTypes[32]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2509,7 +2588,7 @@ func (x *Algorithm_RangeMask) String() string {
func (*Algorithm_RangeMask) ProtoMessage() {}
func (x *Algorithm_RangeMask) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[31]
+ mi := &file_v1_setting_service_proto_msgTypes[32]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2542,7 +2621,7 @@ type Algorithm_MD5Mask struct {
func (x *Algorithm_MD5Mask) Reset() {
*x = Algorithm_MD5Mask{}
- mi := &file_v1_setting_service_proto_msgTypes[32]
+ mi := &file_v1_setting_service_proto_msgTypes[33]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2554,7 +2633,7 @@ func (x *Algorithm_MD5Mask) String() string {
func (*Algorithm_MD5Mask) ProtoMessage() {}
func (x *Algorithm_MD5Mask) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[32]
+ mi := &file_v1_setting_service_proto_msgTypes[33]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2589,7 +2668,7 @@ type Algorithm_InnerOuterMask struct {
func (x *Algorithm_InnerOuterMask) Reset() {
*x = Algorithm_InnerOuterMask{}
- mi := &file_v1_setting_service_proto_msgTypes[33]
+ mi := &file_v1_setting_service_proto_msgTypes[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2601,7 +2680,7 @@ func (x *Algorithm_InnerOuterMask) String() string {
func (*Algorithm_InnerOuterMask) ProtoMessage() {}
func (x *Algorithm_InnerOuterMask) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[33]
+ mi := &file_v1_setting_service_proto_msgTypes[34]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2659,7 +2738,7 @@ type Algorithm_RangeMask_Slice struct {
func (x *Algorithm_RangeMask_Slice) Reset() {
*x = Algorithm_RangeMask_Slice{}
- mi := &file_v1_setting_service_proto_msgTypes[34]
+ mi := &file_v1_setting_service_proto_msgTypes[35]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2671,7 +2750,7 @@ func (x *Algorithm_RangeMask_Slice) String() string {
func (*Algorithm_RangeMask_Slice) ProtoMessage() {}
func (x *Algorithm_RangeMask_Slice) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[34]
+ mi := &file_v1_setting_service_proto_msgTypes[35]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2728,7 +2807,7 @@ type EnvironmentSetting_Environment struct {
func (x *EnvironmentSetting_Environment) Reset() {
*x = EnvironmentSetting_Environment{}
- mi := &file_v1_setting_service_proto_msgTypes[35]
+ mi := &file_v1_setting_service_proto_msgTypes[36]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2740,7 +2819,7 @@ func (x *EnvironmentSetting_Environment) String() string {
func (*EnvironmentSetting_Environment) ProtoMessage() {}
func (x *EnvironmentSetting_Environment) ProtoReflect() protoreflect.Message {
- mi := &file_v1_setting_service_proto_msgTypes[35]
+ mi := &file_v1_setting_service_proto_msgTypes[36]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2844,7 +2923,7 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\x14password_restriction\x18\x0f \x01(\v2'.bytebase.v1.PasswordRestrictionSettingH\x00R\x13passwordRestriction\x12(\n" +
"\x02ai\x18\x10 \x01(\v2\x16.bytebase.v1.AISettingH\x00R\x02ai\x12C\n" +
"\venvironment\x18\x11 \x01(\v2\x1f.bytebase.v1.EnvironmentSettingH\x00R\venvironmentB\a\n" +
- "\x05value\"\xd3\x06\n" +
+ "\x05value\"\x83\b\n" +
"\fAppIMSetting\x12?\n" +
"\bsettings\x18\x01 \x03(\v2#.bytebase.v1.AppIMSetting.IMSettingR\bsettings\x1a\"\n" +
"\x05Slack\x12\x19\n" +
@@ -2865,14 +2944,19 @@ const file_v1_setting_service_proto_rawDesc = "" +
"\tclient_id\x18\x01 \x01(\tB\x03\xe0A\x04R\bclientId\x12(\n" +
"\rclient_secret\x18\x02 \x01(\tB\x03\xe0A\x04R\fclientSecret\x12\"\n" +
"\n" +
- "robot_code\x18\x03 \x01(\tB\x03\xe0A\x04R\trobotCode\x1a\xeb\x02\n" +
+ "robot_code\x18\x03 \x01(\tB\x03\xe0A\x04R\trobotCode\x1au\n" +
+ "\x05Teams\x12 \n" +
+ "\ttenant_id\x18\x01 \x01(\tB\x03\xe0A\x04R\btenantId\x12 \n" +
+ "\tclient_id\x18\x02 \x01(\tB\x03\xe0A\x04R\bclientId\x12(\n" +
+ "\rclient_secret\x18\x03 \x01(\tB\x03\xe0A\x04R\fclientSecret\x1a\xa4\x03\n" +
"\tIMSetting\x12-\n" +
"\x04type\x18\x01 \x01(\x0e2\x19.bytebase.v1.Webhook.TypeR\x04type\x127\n" +
"\x05slack\x18\x02 \x01(\v2\x1f.bytebase.v1.AppIMSetting.SlackH\x00R\x05slack\x12:\n" +
"\x06feishu\x18\x03 \x01(\v2 .bytebase.v1.AppIMSetting.FeishuH\x00R\x06feishu\x127\n" +
"\x05wecom\x18\x04 \x01(\v2\x1f.bytebase.v1.AppIMSetting.WecomH\x00R\x05wecom\x124\n" +
"\x04lark\x18\x05 \x01(\v2\x1e.bytebase.v1.AppIMSetting.LarkH\x00R\x04lark\x12@\n" +
- "\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalkB\t\n" +
+ "\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalk\x127\n" +
+ "\x05teams\x18\a \x01(\v2\x1f.bytebase.v1.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +
"\apayload\"\xff\x05\n" +
"\x17WorkspaceProfileSetting\x12!\n" +
"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +
@@ -3030,7 +3114,7 @@ func file_v1_setting_service_proto_rawDescGZIP() []byte {
}
var file_v1_setting_service_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
-var file_v1_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 37)
+var file_v1_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 38)
var file_v1_setting_service_proto_goTypes = []any{
(DatabaseChangeMode)(0), // 0: bytebase.v1.DatabaseChangeMode
(Setting_SettingName)(0), // 1: bytebase.v1.Setting.SettingName
@@ -3061,31 +3145,32 @@ var file_v1_setting_service_proto_goTypes = []any{
(*AppIMSetting_Wecom)(nil), // 26: bytebase.v1.AppIMSetting.Wecom
(*AppIMSetting_Lark)(nil), // 27: bytebase.v1.AppIMSetting.Lark
(*AppIMSetting_DingTalk)(nil), // 28: bytebase.v1.AppIMSetting.DingTalk
- (*AppIMSetting_IMSetting)(nil), // 29: bytebase.v1.AppIMSetting.IMSetting
- (*WorkspaceApprovalSetting_Rule)(nil), // 30: bytebase.v1.WorkspaceApprovalSetting.Rule
- (*DataClassificationSetting_DataClassificationConfig)(nil), // 31: bytebase.v1.DataClassificationSetting.DataClassificationConfig
- (*DataClassificationSetting_DataClassificationConfig_Level)(nil), // 32: bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level
- (*DataClassificationSetting_DataClassificationConfig_DataClassification)(nil), // 33: bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification
- nil, // 34: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
- (*SemanticTypeSetting_SemanticType)(nil), // 35: bytebase.v1.SemanticTypeSetting.SemanticType
- (*Algorithm_FullMask)(nil), // 36: bytebase.v1.Algorithm.FullMask
- (*Algorithm_RangeMask)(nil), // 37: bytebase.v1.Algorithm.RangeMask
- (*Algorithm_MD5Mask)(nil), // 38: bytebase.v1.Algorithm.MD5Mask
- (*Algorithm_InnerOuterMask)(nil), // 39: bytebase.v1.Algorithm.InnerOuterMask
- (*Algorithm_RangeMask_Slice)(nil), // 40: bytebase.v1.Algorithm.RangeMask.Slice
- (*EnvironmentSetting_Environment)(nil), // 41: bytebase.v1.EnvironmentSetting.Environment
- nil, // 42: bytebase.v1.EnvironmentSetting.Environment.TagsEntry
- (*fieldmaskpb.FieldMask)(nil), // 43: google.protobuf.FieldMask
- (*durationpb.Duration)(nil), // 44: google.protobuf.Duration
- (Webhook_Type)(0), // 45: bytebase.v1.Webhook.Type
- (*ApprovalTemplate)(nil), // 46: bytebase.v1.ApprovalTemplate
- (*expr.Expr)(nil), // 47: google.type.Expr
+ (*AppIMSetting_Teams)(nil), // 29: bytebase.v1.AppIMSetting.Teams
+ (*AppIMSetting_IMSetting)(nil), // 30: bytebase.v1.AppIMSetting.IMSetting
+ (*WorkspaceApprovalSetting_Rule)(nil), // 31: bytebase.v1.WorkspaceApprovalSetting.Rule
+ (*DataClassificationSetting_DataClassificationConfig)(nil), // 32: bytebase.v1.DataClassificationSetting.DataClassificationConfig
+ (*DataClassificationSetting_DataClassificationConfig_Level)(nil), // 33: bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level
+ (*DataClassificationSetting_DataClassificationConfig_DataClassification)(nil), // 34: bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification
+ nil, // 35: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
+ (*SemanticTypeSetting_SemanticType)(nil), // 36: bytebase.v1.SemanticTypeSetting.SemanticType
+ (*Algorithm_FullMask)(nil), // 37: bytebase.v1.Algorithm.FullMask
+ (*Algorithm_RangeMask)(nil), // 38: bytebase.v1.Algorithm.RangeMask
+ (*Algorithm_MD5Mask)(nil), // 39: bytebase.v1.Algorithm.MD5Mask
+ (*Algorithm_InnerOuterMask)(nil), // 40: bytebase.v1.Algorithm.InnerOuterMask
+ (*Algorithm_RangeMask_Slice)(nil), // 41: bytebase.v1.Algorithm.RangeMask.Slice
+ (*EnvironmentSetting_Environment)(nil), // 42: bytebase.v1.EnvironmentSetting.Environment
+ nil, // 43: bytebase.v1.EnvironmentSetting.Environment.TagsEntry
+ (*fieldmaskpb.FieldMask)(nil), // 44: google.protobuf.FieldMask
+ (*durationpb.Duration)(nil), // 45: google.protobuf.Duration
+ (Webhook_Type)(0), // 46: bytebase.v1.Webhook.Type
+ (*ApprovalTemplate)(nil), // 47: bytebase.v1.ApprovalTemplate
+ (*expr.Expr)(nil), // 48: google.type.Expr
}
var file_v1_setting_service_proto_depIdxs = []int32{
11, // 0: bytebase.v1.ListSettingsResponse.settings:type_name -> bytebase.v1.Setting
11, // 1: bytebase.v1.GetSettingResponse.setting:type_name -> bytebase.v1.Setting
11, // 2: bytebase.v1.UpdateSettingRequest.setting:type_name -> bytebase.v1.Setting
- 43, // 3: bytebase.v1.UpdateSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 44, // 3: bytebase.v1.UpdateSettingRequest.update_mask:type_name -> google.protobuf.FieldMask
12, // 4: bytebase.v1.Setting.value:type_name -> bytebase.v1.SettingValue
13, // 5: bytebase.v1.SettingValue.app_im:type_name -> bytebase.v1.AppIMSetting
14, // 6: bytebase.v1.SettingValue.workspace_profile:type_name -> bytebase.v1.WorkspaceProfileSetting
@@ -3096,50 +3181,51 @@ var file_v1_setting_service_proto_depIdxs = []int32{
21, // 11: bytebase.v1.SettingValue.password_restriction:type_name -> bytebase.v1.PasswordRestrictionSetting
22, // 12: bytebase.v1.SettingValue.ai:type_name -> bytebase.v1.AISetting
23, // 13: bytebase.v1.SettingValue.environment:type_name -> bytebase.v1.EnvironmentSetting
- 29, // 14: bytebase.v1.AppIMSetting.settings:type_name -> bytebase.v1.AppIMSetting.IMSetting
- 44, // 15: bytebase.v1.WorkspaceProfileSetting.token_duration:type_name -> google.protobuf.Duration
+ 30, // 14: bytebase.v1.AppIMSetting.settings:type_name -> bytebase.v1.AppIMSetting.IMSetting
+ 45, // 15: bytebase.v1.WorkspaceProfileSetting.token_duration:type_name -> google.protobuf.Duration
15, // 16: bytebase.v1.WorkspaceProfileSetting.announcement:type_name -> bytebase.v1.Announcement
- 44, // 17: bytebase.v1.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
+ 45, // 17: bytebase.v1.WorkspaceProfileSetting.maximum_role_expiration:type_name -> google.protobuf.Duration
0, // 18: bytebase.v1.WorkspaceProfileSetting.database_change_mode:type_name -> bytebase.v1.DatabaseChangeMode
- 44, // 19: bytebase.v1.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
+ 45, // 19: bytebase.v1.WorkspaceProfileSetting.inactive_session_timeout:type_name -> google.protobuf.Duration
2, // 20: bytebase.v1.Announcement.level:type_name -> bytebase.v1.Announcement.AlertLevel
- 30, // 21: bytebase.v1.WorkspaceApprovalSetting.rules:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule
- 31, // 22: bytebase.v1.DataClassificationSetting.configs:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig
- 35, // 23: bytebase.v1.SemanticTypeSetting.types:type_name -> bytebase.v1.SemanticTypeSetting.SemanticType
- 36, // 24: bytebase.v1.Algorithm.full_mask:type_name -> bytebase.v1.Algorithm.FullMask
- 37, // 25: bytebase.v1.Algorithm.range_mask:type_name -> bytebase.v1.Algorithm.RangeMask
- 38, // 26: bytebase.v1.Algorithm.md5_mask:type_name -> bytebase.v1.Algorithm.MD5Mask
- 39, // 27: bytebase.v1.Algorithm.inner_outer_mask:type_name -> bytebase.v1.Algorithm.InnerOuterMask
- 44, // 28: bytebase.v1.PasswordRestrictionSetting.password_rotation:type_name -> google.protobuf.Duration
+ 31, // 21: bytebase.v1.WorkspaceApprovalSetting.rules:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule
+ 32, // 22: bytebase.v1.DataClassificationSetting.configs:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig
+ 36, // 23: bytebase.v1.SemanticTypeSetting.types:type_name -> bytebase.v1.SemanticTypeSetting.SemanticType
+ 37, // 24: bytebase.v1.Algorithm.full_mask:type_name -> bytebase.v1.Algorithm.FullMask
+ 38, // 25: bytebase.v1.Algorithm.range_mask:type_name -> bytebase.v1.Algorithm.RangeMask
+ 39, // 26: bytebase.v1.Algorithm.md5_mask:type_name -> bytebase.v1.Algorithm.MD5Mask
+ 40, // 27: bytebase.v1.Algorithm.inner_outer_mask:type_name -> bytebase.v1.Algorithm.InnerOuterMask
+ 45, // 28: bytebase.v1.PasswordRestrictionSetting.password_rotation:type_name -> google.protobuf.Duration
5, // 29: bytebase.v1.AISetting.provider:type_name -> bytebase.v1.AISetting.Provider
- 41, // 30: bytebase.v1.EnvironmentSetting.environments:type_name -> bytebase.v1.EnvironmentSetting.Environment
- 45, // 31: bytebase.v1.AppIMSetting.IMSetting.type:type_name -> bytebase.v1.Webhook.Type
+ 42, // 30: bytebase.v1.EnvironmentSetting.environments:type_name -> bytebase.v1.EnvironmentSetting.Environment
+ 46, // 31: bytebase.v1.AppIMSetting.IMSetting.type:type_name -> bytebase.v1.Webhook.Type
24, // 32: bytebase.v1.AppIMSetting.IMSetting.slack:type_name -> bytebase.v1.AppIMSetting.Slack
25, // 33: bytebase.v1.AppIMSetting.IMSetting.feishu:type_name -> bytebase.v1.AppIMSetting.Feishu
26, // 34: bytebase.v1.AppIMSetting.IMSetting.wecom:type_name -> bytebase.v1.AppIMSetting.Wecom
27, // 35: bytebase.v1.AppIMSetting.IMSetting.lark:type_name -> bytebase.v1.AppIMSetting.Lark
28, // 36: bytebase.v1.AppIMSetting.IMSetting.dingtalk:type_name -> bytebase.v1.AppIMSetting.DingTalk
- 46, // 37: bytebase.v1.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.v1.ApprovalTemplate
- 47, // 38: bytebase.v1.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
- 3, // 39: bytebase.v1.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule.Source
- 32, // 40: bytebase.v1.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level
- 34, // 41: bytebase.v1.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
- 33, // 42: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification
- 19, // 43: bytebase.v1.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.v1.Algorithm
- 40, // 44: bytebase.v1.Algorithm.RangeMask.slices:type_name -> bytebase.v1.Algorithm.RangeMask.Slice
- 4, // 45: bytebase.v1.Algorithm.InnerOuterMask.type:type_name -> bytebase.v1.Algorithm.InnerOuterMask.MaskType
- 42, // 46: bytebase.v1.EnvironmentSetting.Environment.tags:type_name -> bytebase.v1.EnvironmentSetting.Environment.TagsEntry
- 6, // 47: bytebase.v1.SettingService.ListSettings:input_type -> bytebase.v1.ListSettingsRequest
- 8, // 48: bytebase.v1.SettingService.GetSetting:input_type -> bytebase.v1.GetSettingRequest
- 10, // 49: bytebase.v1.SettingService.UpdateSetting:input_type -> bytebase.v1.UpdateSettingRequest
- 7, // 50: bytebase.v1.SettingService.ListSettings:output_type -> bytebase.v1.ListSettingsResponse
- 11, // 51: bytebase.v1.SettingService.GetSetting:output_type -> bytebase.v1.Setting
- 11, // 52: bytebase.v1.SettingService.UpdateSetting:output_type -> bytebase.v1.Setting
- 50, // [50:53] is the sub-list for method output_type
- 47, // [47:50] is the sub-list for method input_type
- 47, // [47:47] is the sub-list for extension type_name
- 47, // [47:47] is the sub-list for extension extendee
- 0, // [0:47] is the sub-list for field type_name
+ 29, // 37: bytebase.v1.AppIMSetting.IMSetting.teams:type_name -> bytebase.v1.AppIMSetting.Teams
+ 47, // 38: bytebase.v1.WorkspaceApprovalSetting.Rule.template:type_name -> bytebase.v1.ApprovalTemplate
+ 48, // 39: bytebase.v1.WorkspaceApprovalSetting.Rule.condition:type_name -> google.type.Expr
+ 3, // 40: bytebase.v1.WorkspaceApprovalSetting.Rule.source:type_name -> bytebase.v1.WorkspaceApprovalSetting.Rule.Source
+ 33, // 41: bytebase.v1.DataClassificationSetting.DataClassificationConfig.levels:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.Level
+ 35, // 42: bytebase.v1.DataClassificationSetting.DataClassificationConfig.classification:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry
+ 34, // 43: bytebase.v1.DataClassificationSetting.DataClassificationConfig.ClassificationEntry.value:type_name -> bytebase.v1.DataClassificationSetting.DataClassificationConfig.DataClassification
+ 19, // 44: bytebase.v1.SemanticTypeSetting.SemanticType.algorithm:type_name -> bytebase.v1.Algorithm
+ 41, // 45: bytebase.v1.Algorithm.RangeMask.slices:type_name -> bytebase.v1.Algorithm.RangeMask.Slice
+ 4, // 46: bytebase.v1.Algorithm.InnerOuterMask.type:type_name -> bytebase.v1.Algorithm.InnerOuterMask.MaskType
+ 43, // 47: bytebase.v1.EnvironmentSetting.Environment.tags:type_name -> bytebase.v1.EnvironmentSetting.Environment.TagsEntry
+ 6, // 48: bytebase.v1.SettingService.ListSettings:input_type -> bytebase.v1.ListSettingsRequest
+ 8, // 49: bytebase.v1.SettingService.GetSetting:input_type -> bytebase.v1.GetSettingRequest
+ 10, // 50: bytebase.v1.SettingService.UpdateSetting:input_type -> bytebase.v1.UpdateSettingRequest
+ 7, // 51: bytebase.v1.SettingService.ListSettings:output_type -> bytebase.v1.ListSettingsResponse
+ 11, // 52: bytebase.v1.SettingService.GetSetting:output_type -> bytebase.v1.Setting
+ 11, // 53: bytebase.v1.SettingService.UpdateSetting:output_type -> bytebase.v1.Setting
+ 51, // [51:54] is the sub-list for method output_type
+ 48, // [48:51] is the sub-list for method input_type
+ 48, // [48:48] is the sub-list for extension type_name
+ 48, // [48:48] is the sub-list for extension extendee
+ 0, // [0:48] is the sub-list for field type_name
}
func init() { file_v1_setting_service_proto_init() }
@@ -3168,21 +3254,22 @@ func file_v1_setting_service_proto_init() {
(*Algorithm_Md5Mask)(nil),
(*Algorithm_InnerOuterMask_)(nil),
}
- file_v1_setting_service_proto_msgTypes[23].OneofWrappers = []any{
+ file_v1_setting_service_proto_msgTypes[24].OneofWrappers = []any{
(*AppIMSetting_IMSetting_Slack)(nil),
(*AppIMSetting_IMSetting_Feishu)(nil),
(*AppIMSetting_IMSetting_Wecom)(nil),
(*AppIMSetting_IMSetting_Lark)(nil),
(*AppIMSetting_IMSetting_Dingtalk)(nil),
+ (*AppIMSetting_IMSetting_Teams)(nil),
}
- file_v1_setting_service_proto_msgTypes[27].OneofWrappers = []any{}
+ file_v1_setting_service_proto_msgTypes[28].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_setting_service_proto_rawDesc), len(file_v1_setting_service_proto_rawDesc)),
NumEnums: 6,
- NumMessages: 37,
+ NumMessages: 38,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/setting_service_equal.pb.go b/backend/generated-go/v1/setting_service_equal.pb.go
index 3f7604a3ea..79a6ff1213 100644
--- a/backend/generated-go/v1/setting_service_equal.pb.go
+++ b/backend/generated-go/v1/setting_service_equal.pb.go
@@ -228,6 +228,25 @@ func (x *AppIMSetting_DingTalk) Equal(y *AppIMSetting_DingTalk) bool {
return true
}
+func (x *AppIMSetting_Teams) Equal(y *AppIMSetting_Teams) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.TenantId != y.TenantId {
+ return false
+ }
+ if x.ClientId != y.ClientId {
+ return false
+ }
+ if x.ClientSecret != y.ClientSecret {
+ return false
+ }
+ return true
+}
+
func (x *AppIMSetting_IMSetting) Equal(y *AppIMSetting_IMSetting) bool {
if x == y {
return true
@@ -253,6 +272,9 @@ func (x *AppIMSetting_IMSetting) Equal(y *AppIMSetting_IMSetting) bool {
if !x.GetDingtalk().Equal(y.GetDingtalk()) {
return false
}
+ if !x.GetTeams().Equal(y.GetTeams()) {
+ return false
+ }
return true
}
diff --git a/backend/plugin/webhook/teams.go b/backend/plugin/webhook/teams.go
deleted file mode 100644
index 174093a922..0000000000
--- a/backend/plugin/webhook/teams.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package webhook
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "net/http"
-
- "github.com/pkg/errors"
-
- storepb "github.com/bytebase/bytebase/backend/generated-go/store"
-)
-
-var themeColor = "4f46e5"
-
-// TeamsWebhookActionTarget is the API message for Teams webhook action target.
-type TeamsWebhookActionTarget struct {
- OS string `json:"os"`
- URI string `json:"uri"`
-}
-
-// TeamsWebhookAction is the API message for Teams webhook action.
-type TeamsWebhookAction struct {
- Type string `json:"@type"`
- Name string `json:"name"`
- TargetList []TeamsWebhookActionTarget `json:"targets"`
-}
-
-// TeamsWebhookSectionFact is the API message for Teams webhook section fact.
-type TeamsWebhookSectionFact struct {
- Name string `json:"name"`
- Value string `json:"value"`
-}
-
-// TeamsWebhookSection is the API message for Teams webhook section.
-type TeamsWebhookSection struct {
- ActivityTitle string `json:"activityTitle"`
- ActivitySubtitle string `json:"activitySubtitle"`
- FactList []TeamsWebhookSectionFact `json:"facts"`
- Text string `json:"text"`
-}
-
-// TeamsWebhook is the API message for Teams webhook.
-type TeamsWebhook struct {
- Type string `json:"@type"`
- Context string `json:"@context"`
- Summary string `json:"summary"`
- ThemeColor string `json:"themeColor"`
- Title string `json:"title"`
- SectionList []TeamsWebhookSection `json:"sections"`
- ActionList []TeamsWebhookAction `json:"potentialAction"`
-}
-
-func init() {
- Register(storepb.ProjectWebhook_TEAMS, &TeamsReceiver{})
-}
-
-// TeamsReceiver is the receiver for Teams.
-type TeamsReceiver struct {
-}
-
-func (*TeamsReceiver) Post(context Context) error {
- factList := []TeamsWebhookSectionFact{}
- for _, meta := range context.GetMetaList() {
- factList = append(factList, TeamsWebhookSectionFact(meta))
- }
-
- post := TeamsWebhook{
- Type: "MessageCard",
- Context: "https://schema.org/extensions",
- Summary: context.Title,
- ThemeColor: themeColor,
- Title: context.Title,
- SectionList: []TeamsWebhookSection{
- {
- ActivityTitle: fmt.Sprintf("%s (%s)", context.ActorName, context.ActorEmail),
- FactList: factList,
- Text: context.Description,
- },
- },
- ActionList: []TeamsWebhookAction{
- {
- Type: "OpenUri",
- Name: "View in Bytebase",
- TargetList: []TeamsWebhookActionTarget{
- {
- OS: "default",
- URI: context.Link,
- },
- },
- },
- },
- }
- body, err := json.Marshal(post)
- if err != nil {
- return errors.Wrapf(err, "failed to marshal webhook POST request to %s", context.URL)
- }
- req, err := http.NewRequest("POST",
- context.URL, bytes.NewBuffer(body))
- if err != nil {
- return errors.Wrapf(err, "failed to construct webhook POST request to %s", context.URL)
- }
-
- req.Header.Set("Content-Type", "application/json")
- client := &http.Client{
- Timeout: Timeout,
- }
- resp, err := client.Do(req)
- if err != nil {
- return errors.Wrapf(err, "failed to POST webhook to %s", context.URL)
- }
-
- b, err := io.ReadAll(resp.Body)
- if err != nil {
- return errors.Wrapf(err, "failed to read POST webhook response from %s", context.URL)
- }
- defer resp.Body.Close()
-
- if resp.StatusCode != http.StatusOK {
- return errors.Errorf("failed to POST webhook %s, status code: %d, response body: %s", context.URL, resp.StatusCode, b)
- }
-
- if string(b) != "1" {
- return errors.Errorf("%.100s", string(b))
- }
-
- return nil
-}
diff --git a/backend/plugin/webhook/teams/app.go b/backend/plugin/webhook/teams/app.go
new file mode 100644
index 0000000000..cac1c2bd7f
--- /dev/null
+++ b/backend/plugin/webhook/teams/app.go
@@ -0,0 +1,622 @@
+// This file implements Teams direct messaging using Microsoft Graph API and Bot Framework.
+//
+// The flow for sending proactive messages to Teams users:
+// 1. Look up user by email using Graph API (User.Read.All permission)
+// 2. Get Teams app ID from organization's app catalog (AppCatalog.Read.All permission)
+// 3. Install app for user if not already installed (TeamsAppInstallation.ReadWriteSelfForUser.All permission)
+// 4. Get chat ID from the app installation (TeamsAppInstallation.ReadWriteSelfForUser.All permission)
+// 5. Send message via Bot Framework API using the chat ID
+//
+// Documentation:
+// - Microsoft Graph API: https://learn.microsoft.com/en-us/graph/overview
+// - Graph API User Lookup: https://learn.microsoft.com/en-us/graph/api/user-get
+// - Graph API App Installation: https://learn.microsoft.com/en-us/graph/api/userteamwork-post-installedapps
+// - Graph API Get Chat: https://learn.microsoft.com/en-us/graph/api/userscopeteamsappinstallation-get-chat
+// - Bot Framework REST API: https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-send-and-receive-messages
+// - Azure Bot Service: https://learn.microsoft.com/en-us/azure/bot-service/
+// - OAuth2 Client Credentials Flow: https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-flow
+package teams
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "fmt"
+ "io"
+ "net/http"
+ "net/url"
+ "strings"
+ "sync"
+ "time"
+
+ lru "github.com/hashicorp/golang-lru/v2"
+ "github.com/pkg/errors"
+)
+
+type provider struct {
+ tenantID string
+ clientID string
+ clientSecret string
+ c *http.Client
+ graphToken string
+ botToken string
+}
+
+func newProvider(tenantID, clientID, clientSecret string) *provider {
+ return &provider{
+ tenantID: tenantID,
+ clientID: clientID,
+ clientSecret: clientSecret,
+ c: &http.Client{},
+ }
+}
+
+type tokenResponse struct {
+ AccessToken string `json:"access_token"`
+ ExpiresIn int `json:"expires_in"`
+ TokenType string `json:"token_type"`
+}
+
+type tokenKey struct {
+ tenantID string
+ clientID string
+ clientSecret string
+ scope string
+}
+
+type tokenValue struct {
+ token string
+ expireAt time.Time
+}
+
+var (
+ tokenCacheLock sync.Mutex
+ tokenCache = func() *lru.Cache[tokenKey, *tokenValue] {
+ cache, err := lru.New[tokenKey, *tokenValue](10)
+ if err != nil {
+ panic(err)
+ }
+ return cache
+ }()
+)
+
+const (
+ graphScope = "https://graph.microsoft.com/.default"
+ botScope = "https://api.botframework.com/.default"
+)
+
+// getToken fetches an OAuth2 token using client credentials flow.
+func getToken(ctx context.Context, c *http.Client, tenantID, clientID, clientSecret, scope string) (*tokenValue, error) {
+ tokenURL := fmt.Sprintf("https://login.microsoftonline.com/%s/oauth2/v2.0/token", tenantID)
+
+ data := url.Values{}
+ data.Set("client_id", clientID)
+ data.Set("client_secret", clientSecret)
+ data.Set("scope", scope)
+ data.Set("grant_type", "client_credentials")
+
+ req, err := http.NewRequestWithContext(ctx, http.MethodPost, tokenURL, strings.NewReader(data.Encode()))
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to construct token request")
+ }
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+
+ resp, err := c.Do(req)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to request token")
+ }
+ defer resp.Body.Close()
+
+ b, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to read token response")
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ return nil, errors.Errorf("token request failed (status %d): %s", resp.StatusCode, string(b))
+ }
+
+ var tokenResp tokenResponse
+ if err := json.Unmarshal(b, &tokenResp); err != nil {
+ return nil, errors.Wrapf(err, "failed to unmarshal token response")
+ }
+
+ return &tokenValue{
+ token: tokenResp.AccessToken,
+ expireAt: time.Now().Add(time.Second * time.Duration(tokenResp.ExpiresIn)),
+ }, nil
+}
+
+func getTokenCached(ctx context.Context, c *http.Client, tenantID, clientID, clientSecret, scope string) (string, error) {
+ tokenCacheLock.Lock()
+ defer tokenCacheLock.Unlock()
+
+ key := tokenKey{
+ tenantID: tenantID,
+ clientID: clientID,
+ clientSecret: clientSecret,
+ scope: scope,
+ }
+
+ token, ok := tokenCache.Get(key)
+ if ok && time.Now().Before(token.expireAt.Add(-time.Minute)) {
+ return token.token, nil
+ }
+
+ token, err := getToken(ctx, c, tenantID, clientID, clientSecret, scope)
+ if err != nil {
+ return "", err
+ }
+ tokenCache.Add(key, token)
+
+ return token.token, nil
+}
+
+func (p *provider) refreshGraphToken(ctx context.Context) error {
+ token, err := getTokenCached(ctx, p.c, p.tenantID, p.clientID, p.clientSecret, graphScope)
+ if err != nil {
+ return err
+ }
+ p.graphToken = token
+ return nil
+}
+
+func (p *provider) refreshBotToken(ctx context.Context) error {
+ token, err := getTokenCached(ctx, p.c, p.tenantID, p.clientID, p.clientSecret, botScope)
+ if err != nil {
+ return err
+ }
+ p.botToken = token
+ return nil
+}
+
+// userResponse is the response from Microsoft Graph API for user lookup.
+type userResponse struct {
+ ID string `json:"id"`
+ UserPrincipalName string `json:"userPrincipalName"`
+ Mail string `json:"mail"`
+}
+
+// teamsAppInstallation represents an installed Teams app.
+type teamsAppInstallation struct {
+ ID string `json:"id"`
+}
+
+// teamsAppInstallationsResponse is the response for listing installed apps.
+type teamsAppInstallationsResponse struct {
+ Value []teamsAppInstallation `json:"value"`
+}
+
+// chatResponse is the response from the chat endpoint.
+type chatResponse struct {
+ ID string `json:"id"`
+}
+
+var userIDCache = func() *lru.Cache[string, string] {
+ cache, err := lru.New[string, string](5000)
+ if err != nil {
+ panic(err)
+ }
+ return cache
+}()
+
+// getIDByEmail gets user AAD object ID by email using Microsoft Graph API.
+// https://learn.microsoft.com/en-us/graph/api/user-get
+func (p *provider) getIDByEmail(ctx context.Context, emails []string) (map[string]string, error) {
+ userID := make(map[string]string)
+ var emailsToGet []string
+
+ for _, email := range emails {
+ id, ok := userIDCache.Get(email)
+ if ok {
+ if id != "" {
+ userID[email] = id
+ }
+ } else {
+ emailsToGet = append(emailsToGet, email)
+ }
+ }
+
+ if len(emailsToGet) == 0 {
+ return userID, nil
+ }
+
+ if p.graphToken == "" {
+ if err := p.refreshGraphToken(ctx); err != nil {
+ return nil, errors.Wrapf(err, "failed to refresh graph token")
+ }
+ }
+
+ for _, email := range emailsToGet {
+ id, err := p.getUserIDByEmail(ctx, email)
+ if err != nil {
+ // Cache empty string for not found users to avoid repeated lookups.
+ userIDCache.Add(email, "")
+ continue
+ }
+ userID[email] = id
+ userIDCache.Add(email, id)
+ }
+
+ return userID, nil
+}
+
+// usersResponse is the response from Microsoft Graph API for user list queries.
+type usersResponse struct {
+ Value []userResponse `json:"value"`
+}
+
+func (p *provider) getUserIDByEmail(ctx context.Context, email string) (string, error) {
+ // First, try to get user directly by userPrincipalName.
+ apiURL := fmt.Sprintf("https://graph.microsoft.com/v1.0/users/%s", url.PathEscape(email))
+
+ b, err := p.doGraphRequest(ctx, http.MethodGet, apiURL, nil)
+ if err == nil {
+ var user userResponse
+ if err := json.Unmarshal(b, &user); err == nil && user.ID != "" {
+ return user.ID, nil
+ }
+ }
+
+ // If direct lookup fails, search by mail field (needed for guest users).
+ // Guest users have UPNs like "user_domain.com#EXT#@tenant.onmicrosoft.com"
+ // but their mail field contains the original email.
+ filterURL := fmt.Sprintf("https://graph.microsoft.com/v1.0/users?$filter=mail%%20eq%%20'%s'", url.QueryEscape(email))
+ b, err = p.doGraphRequest(ctx, http.MethodGet, filterURL, nil)
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to search user by mail")
+ }
+
+ var users usersResponse
+ if err := json.Unmarshal(b, &users); err != nil {
+ return "", errors.Wrapf(err, "failed to unmarshal users response")
+ }
+
+ if len(users.Value) == 0 {
+ return "", errors.Errorf("user with email %s not found", email)
+ }
+
+ return users.Value[0].ID, nil
+}
+
+// getTeamsAppID retrieves the Teams app ID from the app catalog.
+// The app must be published to the organization's app catalog.
+func (p *provider) getTeamsAppID(ctx context.Context) (string, error) {
+ // The externalId in the app catalog is the same as the clientID (Azure AD app ID).
+ apiURL := fmt.Sprintf("https://graph.microsoft.com/v1.0/appCatalogs/teamsApps?$filter=externalId%%20eq%%20'%s'", p.clientID)
+
+ b, err := p.doGraphRequest(ctx, http.MethodGet, apiURL, nil)
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to query app catalog")
+ }
+
+ var resp struct {
+ Value []struct {
+ ID string `json:"id"`
+ } `json:"value"`
+ }
+ if err := json.Unmarshal(b, &resp); err != nil {
+ return "", errors.Wrapf(err, "failed to unmarshal app catalog response")
+ }
+
+ if len(resp.Value) == 0 {
+ return "", errors.Errorf("Teams app with externalId %s not found in app catalog", p.clientID)
+ }
+
+ return resp.Value[0].ID, nil
+}
+
+// ensureAppInstalledForUser ensures the Teams app is installed for a user.
+// Returns the installation ID.
+func (p *provider) ensureAppInstalledForUser(ctx context.Context, userAADID, teamsAppID string) (string, error) {
+ // First, check if the app is already installed.
+ listURL := fmt.Sprintf("https://graph.microsoft.com/v1.0/users/%s/teamwork/installedApps?$filter=teamsApp/externalId%%20eq%%20'%s'&$expand=teamsApp", userAADID, p.clientID)
+
+ b, err := p.doGraphRequest(ctx, http.MethodGet, listURL, nil)
+ if err == nil {
+ var resp teamsAppInstallationsResponse
+ if err := json.Unmarshal(b, &resp); err == nil && len(resp.Value) > 0 {
+ return resp.Value[0].ID, nil
+ }
+ }
+
+ // App not installed, install it.
+ installURL := fmt.Sprintf("https://graph.microsoft.com/v1.0/users/%s/teamwork/installedApps", userAADID)
+ installBody := fmt.Sprintf(`{"[email protected]":"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/%s"}`, teamsAppID)
+
+ _, err = p.doGraphRequest(ctx, http.MethodPost, installURL, []byte(installBody))
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to install Teams app for user")
+ }
+
+ // Retrieve the installation ID.
+ b, err = p.doGraphRequest(ctx, http.MethodGet, listURL, nil)
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to get installation after install")
+ }
+
+ var resp teamsAppInstallationsResponse
+ if err := json.Unmarshal(b, &resp); err != nil {
+ return "", errors.Wrapf(err, "failed to unmarshal installation response")
+ }
+
+ if len(resp.Value) == 0 {
+ return "", errors.Errorf("installation not found after installing app")
+ }
+
+ return resp.Value[0].ID, nil
+}
+
+// getChatIDForUser gets the chat ID for a user's app installation.
+func (p *provider) getChatIDForUser(ctx context.Context, userAADID, installationID string) (string, error) {
+ apiURL := fmt.Sprintf("https://graph.microsoft.com/v1.0/users/%s/teamwork/installedApps/%s/chat", userAADID, installationID)
+
+ b, err := p.doGraphRequest(ctx, http.MethodGet, apiURL, nil)
+ if err != nil {
+ return "", errors.Wrapf(err, "failed to get chat for installation")
+ }
+
+ var resp chatResponse
+ if err := json.Unmarshal(b, &resp); err != nil {
+ return "", errors.Wrapf(err, "failed to unmarshal chat response")
+ }
+
+ return resp.ID, nil
+}
+
+func (p *provider) doGraphRequest(ctx context.Context, method, apiURL string, data []byte) ([]byte, error) {
+ const maxRetries = 3
+
+ for i := 0; i < maxRetries; i++ {
+ if ctx.Err() != nil {
+ return nil, ctx.Err()
+ }
+
+ b, retry, err := func() ([]byte, bool, error) {
+ var body io.Reader
+ if data != nil {
+ body = bytes.NewReader(data)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, method, apiURL, body)
+ if err != nil {
+ return nil, false, errors.Wrapf(err, "failed to construct request")
+ }
+
+ req.Header.Set("Authorization", "Bearer "+p.graphToken)
+ if data != nil {
+ req.Header.Set("Content-Type", "application/json")
+ }
+
+ resp, err := p.c.Do(req)
+ if err != nil {
+ return nil, false, errors.Wrapf(err, "request failed")
+ }
+ defer resp.Body.Close()
+
+ respBody, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, false, errors.Wrapf(err, "failed to read response")
+ }
+
+ if resp.StatusCode == http.StatusUnauthorized {
+ if err := p.refreshGraphToken(ctx); err != nil {
+ return nil, false, errors.Wrapf(err, "failed to refresh token")
+ }
+ return nil, true, nil
+ }
+
+ if resp.StatusCode < 200 || resp.StatusCode >= 300 {
+ return nil, false, errors.Errorf("request failed with status %d: %s", resp.StatusCode, string(respBody))
+ }
+
+ return respBody, false, nil
+ }()
+
+ if err != nil {
+ return nil, err
+ }
+ if retry {
+ continue
+ }
+ return b, nil
+ }
+
+ return nil, errors.Errorf("exceeded max retries for %s %s", method, apiURL)
+}
+
+// Bot Framework types for messaging.
+
+type activity struct {
+ Type string `json:"type"`
+ Text string `json:"text,omitempty"`
+ Attachments []attachment `json:"attachments,omitempty"`
+}
+
+type attachment struct {
+ ContentType string `json:"contentType"`
+ Content any `json:"content"`
+}
+
+// AdaptiveCard represents a Microsoft Adaptive Card.
+// Adaptive Card schema: https://adaptivecards.io/explorer/
+// Adaptive Card designer: https://adaptivecards.io/designer/
+// Adaptive Card documentation: https://learn.microsoft.com/en-us/adaptive-cards/
+type AdaptiveCard struct {
+ Type string `json:"type"`
+ Version string `json:"version"`
+ Body []any `json:"body"`
+ Actions []any `json:"actions,omitempty"`
+}
+
+type textBlock struct {
+ Type string `json:"type"`
+ Text string `json:"text"`
+ Size string `json:"size,omitempty"`
+ Weight string `json:"weight,omitempty"`
+ Wrap bool `json:"wrap,omitempty"`
+}
+
+type factSet struct {
+ Type string `json:"type"`
+ Facts []fact `json:"facts"`
+}
+
+type fact struct {
+ Title string `json:"title"`
+ Value string `json:"value"`
+}
+
+type actionOpenURL struct {
+ Type string `json:"type"`
+ Title string `json:"title"`
+ URL string `json:"url"`
+}
+
+const (
+ // serviceURL is the Bot Framework service URL for Teams.
+ // https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages#get-the-user-id-team-id-or-channel-id
+ serviceURL = "https://smba.trafficmanager.net/teams"
+)
+
+// sendMessage sends a message to a user via Bot Framework.
+// It ensures the Teams app is installed for the user first, then sends the message
+// using the chat ID obtained from the installation.
+func (p *provider) sendMessage(ctx context.Context, userAADID string, card *AdaptiveCard) error {
+ // First, ensure we have a Graph token.
+ if p.graphToken == "" {
+ if err := p.refreshGraphToken(ctx); err != nil {
+ return errors.Wrapf(err, "failed to refresh graph token")
+ }
+ }
+
+ // Get the Teams app ID from the app catalog.
+ teamsAppID, err := p.getTeamsAppID(ctx)
+ if err != nil {
+ return errors.Wrapf(err, "failed to get Teams app ID from catalog")
+ }
+
+ // Ensure the app is installed for the user.
+ installationID, err := p.ensureAppInstalledForUser(ctx, userAADID, teamsAppID)
+ if err != nil {
+ return errors.Wrapf(err, "failed to ensure app is installed for user")
+ }
+
+ // Get the chat ID for the user's app installation.
+ chatID, err := p.getChatIDForUser(ctx, userAADID, installationID)
+ if err != nil {
+ return errors.Wrapf(err, "failed to get chat ID for user")
+ }
+
+ // Send the message via Bot Framework using the chat ID as conversation ID.
+ return p.sendMessageToConversation(ctx, chatID, card)
+}
+
+// sendMessageToConversation sends an Adaptive Card message to a conversation via Bot Framework.
+func (p *provider) sendMessageToConversation(ctx context.Context, conversationID string, card *AdaptiveCard) error {
+ if p.botToken == "" {
+ if err := p.refreshBotToken(ctx); err != nil {
+ return errors.Wrapf(err, "failed to refresh bot token")
+ }
+ }
+
+ apiURL := fmt.Sprintf("%s/v3/conversations/%s/activities", serviceURL, conversationID)
+
+ act := activity{
+ Type: "message",
+ Attachments: []attachment{
+ {
+ ContentType: "application/vnd.microsoft.card.adaptive",
+ Content: card,
+ },
+ },
+ }
+
+ data, err := json.Marshal(act)
+ if err != nil {
+ return errors.Wrapf(err, "failed to marshal activity")
+ }
+
+ _, err = p.doBotRequest(ctx, http.MethodPost, apiURL, data)
+ if err != nil {
+ return errors.Wrapf(err, "failed to send message to conversation")
+ }
+
+ return nil
+}
+
+func (p *provider) doBotRequest(ctx context.Context, method, apiURL string, data []byte) ([]byte, error) {
+ const maxRetries = 3
+
+ for i := 0; i < maxRetries; i++ {
+ if ctx.Err() != nil {
+ return nil, ctx.Err()
+ }
+
+ b, retry, err := func() ([]byte, bool, error) {
+ req, err := http.NewRequestWithContext(ctx, method, apiURL, bytes.NewReader(data))
+ if err != nil {
+ return nil, false, errors.Wrapf(err, "failed to construct request")
+ }
+
+ req.Header.Set("Authorization", "Bearer "+p.botToken)
+ req.Header.Set("Content-Type", "application/json")
+
+ resp, err := p.c.Do(req)
+ if err != nil {
+ return nil, false, errors.Wrapf(err, "request failed")
+ }
+ defer resp.Body.Close()
+
+ respBody, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return nil, false, errors.Wrapf(err, "failed to read response")
+ }
+
+ if resp.StatusCode == http.StatusUnauthorized {
+ if err := p.refreshBotToken(ctx); err != nil {
+ return nil, false, errors.Wrapf(err, "failed to refresh token")
+ }
+ return nil, true, nil
+ }
+
+ if resp.StatusCode < 200 || resp.StatusCode >= 300 {
+ return nil, false, errors.Errorf("request failed with status %d: %s", resp.StatusCode, string(respBody))
+ }
+
+ return respBody, false, nil
+ }()
+
+ if err != nil {
+ return nil, err
+ }
+ if retry {
+ continue
+ }
+ return b, nil
+ }
+
+ return nil, errors.Errorf("exceeded max retries for %s %s", method, apiURL)
+}
+
+// Validate validates the Teams configuration by attempting to get a token and look up a user.
+func Validate(ctx context.Context, tenantID, clientID, clientSecret, email string) error {
+ // Trim whitespace from all inputs to prevent copy-paste issues.
+ tenantID = strings.TrimSpace(tenantID)
+ clientID = strings.TrimSpace(clientID)
+ clientSecret = strings.TrimSpace(clientSecret)
+ email = strings.TrimSpace(email)
+
+ p := newProvider(tenantID, clientID, clientSecret)
+
+ if err := p.refreshGraphToken(ctx); err != nil {
+ return errors.Wrapf(err, "failed to get Graph API token")
+ }
+
+ _, err := p.getIDByEmail(ctx, []string{email})
+ if err != nil {
+ return errors.Wrapf(err, "failed to look up user %s", email)
+ }
+
+ return nil
+}
diff --git a/backend/plugin/webhook/teams/teams.go b/backend/plugin/webhook/teams/teams.go
new file mode 100644
index 0000000000..b36a7f7baf
--- /dev/null
+++ b/backend/plugin/webhook/teams/teams.go
@@ -0,0 +1,298 @@
+// Package teams implements Microsoft Teams webhook and direct message integration.
+//
+// Documentation:
+// - Teams Webhooks (Incoming Webhook): https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
+// - MessageCard Format: https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
+// - Adaptive Cards: https://learn.microsoft.com/en-us/adaptive-cards/
+// - Proactive Messaging: https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages
+// - Graph API App Installation: https://learn.microsoft.com/en-us/microsoftteams/platform/graph-api/proactive-bots-and-messages/graph-proactive-bots-and-messages
+package teams
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "fmt"
+ "io"
+ "log/slog"
+ "net/http"
+ "strings"
+
+ "github.com/pkg/errors"
+ "go.uber.org/multierr"
+
+ "github.com/bytebase/bytebase/backend/common"
+ "github.com/bytebase/bytebase/backend/common/log"
+ storepb "github.com/bytebase/bytebase/backend/generated-go/store"
+ "github.com/bytebase/bytebase/backend/plugin/webhook"
+)
+
+var themeColor = "4f46e5"
+
+// getTeamsConfig extracts the Teams configuration from the AppIMSetting.
+func getTeamsConfig(setting *storepb.AppIMSetting) *storepb.AppIMSetting_Teams {
+ if setting == nil {
+ return nil
+ }
+ for _, s := range setting.Settings {
+ if s.Type == storepb.ProjectWebhook_TEAMS {
+ return s.GetTeams()
+ }
+ }
+ return nil
+}
+
+// WebhookActionTarget is the API message for Teams webhook action target.
+type WebhookActionTarget struct {
+ OS string `json:"os"`
+ URI string `json:"uri"`
+}
+
+// WebhookAction is the API message for Teams webhook action.
+type WebhookAction struct {
+ Type string `json:"@type"`
+ Name string `json:"name"`
+ TargetList []WebhookActionTarget `json:"targets"`
+}
+
+// WebhookSectionFact is the API message for Teams webhook section fact.
+type WebhookSectionFact struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+}
+
+// WebhookSection is the API message for Teams webhook section.
+type WebhookSection struct {
+ ActivityTitle string `json:"activityTitle"`
+ ActivitySubtitle string `json:"activitySubtitle"`
+ FactList []WebhookSectionFact `json:"facts"`
+ Text string `json:"text"`
+}
+
+// Webhook is the API message for Teams webhook (MessageCard format).
+// MessageCard reference: https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference
+// MessageCard designer: https://amdesigner.azurewebsites.net/
+type Webhook struct {
+ Type string `json:"@type"`
+ Context string `json:"@context"`
+ Summary string `json:"summary"`
+ ThemeColor string `json:"themeColor"`
+ Title string `json:"title"`
+ SectionList []WebhookSection `json:"sections"`
+ ActionList []WebhookAction `json:"potentialAction"`
+}
+
+func init() {
+ webhook.Register(storepb.ProjectWebhook_TEAMS, &Receiver{})
+}
+
+// Receiver is the receiver for Teams.
+type Receiver struct {
+}
+
+func (*Receiver) Post(context webhook.Context) error {
+ if context.DirectMessage && len(context.MentionEndUsers) > 0 {
+ if postDirectMessage(context) {
+ return nil
+ }
+ }
+ return postMessage(context)
+}
+
+func postDirectMessage(webhookCtx webhook.Context) bool {
+ teams := getTeamsConfig(webhookCtx.IMSetting)
+ if teams == nil {
+ return false
+ }
+
+ p := newProvider(teams.TenantId, teams.ClientId, teams.ClientSecret)
+ ctx := context.Background()
+
+ sent := map[string]bool{}
+
+ if err := common.Retry(ctx, func() error {
+ var errs error
+
+ var emails []string
+ for _, u := range webhookCtx.MentionEndUsers {
+ if sent[u.Email] {
+ continue
+ }
+ emails = append(emails, u.Email)
+ }
+
+ idByEmail, err := p.getIDByEmail(ctx, emails)
+ if err != nil {
+ return errors.Wrapf(err, "failed to get id by email")
+ }
+
+ for _, u := range webhookCtx.MentionEndUsers {
+ if sent[u.Email] {
+ continue
+ }
+ id, ok := idByEmail[u.Email]
+ if !ok {
+ continue
+ }
+
+ err := p.sendMessage(ctx, id, getAdaptiveCard(webhookCtx))
+ if err != nil {
+ slog.Error("Teams failed to send message",
+ slog.String("email", u.Email),
+ log.BBError(err))
+ err = errors.Wrapf(err, "failed to send message to %s", u.Email)
+ multierr.AppendInto(&errs, err)
+ }
+ sent[u.Email] = true
+ }
+ return errs
+ }); err != nil {
+ slog.Warn("failed to send direct message to Teams user", log.BBError(err))
+ return false
+ }
+
+ return true
+}
+
+func postMessage(context webhook.Context) error {
+ factList := []WebhookSectionFact{}
+ for _, meta := range context.GetMetaList() {
+ factList = append(factList, WebhookSectionFact(meta))
+ }
+
+ post := Webhook{
+ Type: "MessageCard",
+ Context: "https://schema.org/extensions",
+ Summary: context.Title,
+ ThemeColor: themeColor,
+ Title: context.Title,
+ SectionList: []WebhookSection{
+ {
+ ActivityTitle: fmt.Sprintf("%s (%s)", context.ActorName, context.ActorEmail),
+ FactList: factList,
+ Text: context.Description,
+ },
+ },
+ ActionList: []WebhookAction{
+ {
+ Type: "OpenUri",
+ Name: "View in Bytebase",
+ TargetList: []WebhookActionTarget{
+ {
+ OS: "default",
+ URI: context.Link,
+ },
+ },
+ },
+ },
+ }
+ body, err := json.Marshal(post)
+ if err != nil {
+ return errors.Wrapf(err, "failed to marshal webhook POST request to %s", context.URL)
+ }
+ req, err := http.NewRequest("POST",
+ context.URL, bytes.NewBuffer(body))
+ if err != nil {
+ return errors.Wrapf(err, "failed to construct webhook POST request to %s", context.URL)
+ }
+
+ req.Header.Set("Content-Type", "application/json")
+ client := &http.Client{
+ Timeout: webhook.Timeout,
+ }
+ resp, err := client.Do(req)
+ if err != nil {
+ return errors.Wrapf(err, "failed to POST webhook to %s", context.URL)
+ }
+
+ b, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return errors.Wrapf(err, "failed to read POST webhook response from %s", context.URL)
+ }
+ defer resp.Body.Close()
+
+ if resp.StatusCode != http.StatusOK {
+ return errors.Errorf("failed to POST webhook %s, status code: %d, response body: %s", context.URL, resp.StatusCode, b)
+ }
+
+ if string(b) != "1" {
+ return errors.Errorf("%.100s", string(b))
+ }
+
+ return nil
+}
+
+// getAdaptiveCard creates an Adaptive Card for Teams direct messages.
+func getAdaptiveCard(context webhook.Context) *AdaptiveCard {
+ var body []any
+
+ // Title
+ body = append(body, textBlock{
+ Type: "TextBlock",
+ Text: context.Title,
+ Size: "Large",
+ Weight: "Bolder",
+ Wrap: true,
+ })
+
+ // Description
+ if context.Description != "" {
+ body = append(body, textBlock{
+ Type: "TextBlock",
+ Text: context.Description,
+ Wrap: true,
+ })
+ }
+
+ // Facts (metadata)
+ var facts []fact
+ for _, meta := range context.GetMetaList() {
+ facts = append(facts, fact{
+ Title: meta.Name,
+ Value: meta.Value,
+ })
+ }
+ facts = append(facts, fact{
+ Title: "Actor",
+ Value: fmt.Sprintf("%s (%s)", context.ActorName, context.ActorEmail),
+ })
+
+ if len(facts) > 0 {
+ body = append(body, factSet{
+ Type: "FactSet",
+ Facts: facts,
+ })
+ }
+
+ // Actions
+ var actions []any
+ actions = append(actions, actionOpenURL{
+ Type: "Action.OpenUrl",
+ Title: "View in Bytebase",
+ URL: context.Link,
+ })
+
+ return &AdaptiveCard{
+ Type: "AdaptiveCard",
+ Version: "1.4",
+ Body: body,
+ Actions: actions,
+ }
+}
+
+// GetMarkdownText returns the markdown text for the webhook context.
+func GetMarkdownText(context webhook.Context) string {
+ var markdownBuf strings.Builder
+
+ if context.Description != "" {
+ _, _ = markdownBuf.WriteString(fmt.Sprintf("%s\n\n", context.Description))
+ }
+
+ for _, meta := range context.GetMetaList() {
+ _, _ = markdownBuf.WriteString(fmt.Sprintf("**%s**: %s\n", meta.Name, meta.Value))
+ }
+
+ _, _ = markdownBuf.WriteString(fmt.Sprintf("\n**Actor**: %s (%s)\n\n[View in Bytebase](%s)", context.ActorName, context.ActorEmail, context.Link))
+
+ return markdownBuf.String()
+}
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 58eb1cf71e..133ef5ecee 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -490,7 +490,7 @@
"assign-role": "Assign role | Assign roles"
},
"im-integration": {
- "description": "Push direct messages to users for specific issue events. Works with project webhook."
+ "description": "The IM integration will be used to push direct messages to users for specific issue events. Works with the project webhook."
},
"sso": {
"create": "Create SSO",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index b0efee1609..b1ae21eb9f 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -490,7 +490,7 @@
"assign-role": "Asignar rol | Asignar roles"
},
"im-integration": {
- "description": "Envíe mensajes directos a los usuarios para eventos de problemas específicos. Funciona con el webhook del proyecto."
+ "description": "La integración de IM se utilizará para enviar mensajes directos a los usuarios para eventos de incidencias específicos. Funciona con el webhook del proyecto."
},
"sso": {
"create": "Crear SSO",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 233abe7022..ef6b1562fc 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -490,7 +490,7 @@
"assign-role": "役割の割り当て | 役割の割り当て"
},
"im-integration": {
- "description": "特定のイシューイベントについて、プライベート メッセージをユーザーにプッシュします。プロジェクト Webhook で使用する必要があります。"
+ "description": "IM 統合は、特定のイシューイベントについてユーザーにダイレクトメッセージをプッシュするために使用されます。プロジェクト Webhook と連携して動作します。"
},
"sso": {
"create": "SSOの作成",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 456b0c16e7..115d1746c5 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -490,7 +490,7 @@
"assign-role": "Gán vai trò | Gán vai trò"
},
"im-integration": {
- "description": "Đẩy tin nhắn trực tiếp đến người dùng cho các sự kiện vấn đề cụ thể. Hoạt động với webhook của dự án."
+ "description": "Tích hợp IM sẽ được sử dụng để đẩy tin nhắn trực tiếp đến người dùng cho các sự kiện vấn đề cụ thể. Hoạt động với webhook của dự án."
},
"sso": {
"create": "Tạo SSO",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index c5e31efec2..b058785be3 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -490,7 +490,7 @@
"assign-role": "分配角色 | 分配角色"
},
"im-integration": {
- "description": "针对特定工单事件向用户推送私信消息。需要与项目 webhook 配合使用。"
+ "description": "即时通讯集成用于针对特定工单事件向用户推送私信消息。需要与项目 webhook 配合使用。"
},
"sso": {
"create": "创建 SSO",
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
index fd82292189..7c48336aaf 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts
@@ -440,6 +440,38 @@ export declare type AppIMSetting_DingTalk = Message<"bytebase.v1.AppIMSetting.Di
*/
export declare const AppIMSetting_DingTalkSchema: GenMessage<AppIMSetting_DingTalk>;
+/**
+ * @generated from message bytebase.v1.AppIMSetting.Teams
+ */
+export declare type AppIMSetting_Teams = Message<"bytebase.v1.AppIMSetting.Teams"> & {
+ /**
+ * Azure AD tenant ID (Directory ID).
+ *
+ * @generated from field: string tenant_id = 1;
+ */
+ tenantId: string;
+
+ /**
+ * Azure AD application (client) ID.
+ *
+ * @generated from field: string client_id = 2;
+ */
+ clientId: string;
+
+ /**
+ * Azure AD client secret.
+ *
+ * @generated from field: string client_secret = 3;
+ */
+ clientSecret: string;
+};
+
+/**
+ * Describes the message bytebase.v1.AppIMSetting.Teams.
+ * Use `create(AppIMSetting_TeamsSchema)` to create a new message.
+ */
+export declare const AppIMSetting_TeamsSchema: GenMessage<AppIMSetting_Teams>;
+
/**
* @generated from message bytebase.v1.AppIMSetting.IMSetting
*/
@@ -482,6 +514,12 @@ export declare type AppIMSetting_IMSetting = Message<"bytebase.v1.AppIMSetting.I
*/
value: AppIMSetting_DingTalk;
case: "dingtalk";
+ } | {
+ /**
+ * @generated from field: bytebase.v1.AppIMSetting.Teams teams = 7;
+ */
+ value: AppIMSetting_Teams;
+ case: "teams";
} | { case: undefined; value?: undefined };
};
diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.js b/frontend/src/types/proto-es/v1/setting_service_pb.js
index bbe2e1ced8..2e90ce808e 100644
--- a/frontend/src/types/proto-es/v1/setting_service_pb.js
+++ b/frontend/src/types/proto-es/v1/setting_service_pb.js
@@ -17,7 +17,7 @@ import { file_v1_project_service } from "./project_service_pb";
* Describes the file v1/setting_service.proto.
*/
export const file_v1_setting_service = /*@__PURE__*/
- fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J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pc3RTZXR0aW5nc1JlcXVlc3QaIS5ieXRlYmFzZS52MS5MaXN0U2V0dGluZ3NSZXNwb25zZSIv2kEAiuowEGJiLnNldHRpbmdzLmxpc3SQ6jABgtPkkwIOEgwvdjEvc2V0dGluZ3MSfwoKR2V0U2V0dGluZxIeLmJ5dGViYXNlLnYxLkdldFNldHRpbmdSZXF1ZXN0GhQuYnl0ZWJhc2UudjEuU2V0dGluZyI72kEEbmFtZYrqMA9iYi5zZXR0aW5ncy5nZXSQ6jABgtPkkwIXEhUvdjEve25hbWU9c2V0dGluZ3MvKn0SkwEKDVVwZGF0ZVNldHRpbmcSIS5ieXRlYmFzZS52MS5VcGRhdGVTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciSYrqMA9iYi5zZXR0aW5ncy5zZXSQ6jABmOowAYLT5JMCKDoHc2V0dGluZzIdL3YxL3tzZXR0aW5nLm5hbWU9c2V0dGluZ3MvKn1CqQEKD2NvbS5ieXRlYmFzZS52MUITU2V0dGluZ1NlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_issue_service, file_v1_project_service]);
+ fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN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IgLmJ5dGViYXNlLnYxLkxpc3RTZXR0aW5nc1JlcXVlc3QaIS5ieXRlYmFzZS52MS5MaXN0U2V0dGluZ3NSZXNwb25zZSIv2kEAiuowEGJiLnNldHRpbmdzLmxpc3SQ6jABgtPkkwIOEgwvdjEvc2V0dGluZ3MSfwoKR2V0U2V0dGluZxIeLmJ5dGViYXNlLnYxLkdldFNldHRpbmdSZXF1ZXN0GhQuYnl0ZWJhc2UudjEuU2V0dGluZyI72kEEbmFtZYrqMA9iYi5zZXR0aW5ncy5nZXSQ6jABgtPkkwIXEhUvdjEve25hbWU9c2V0dGluZ3MvKn0SkwEKDVVwZGF0ZVNldHRpbmcSIS5ieXRlYmFzZS52MS5VcGRhdGVTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciSYrqMA9iYi5zZXR0aW5ncy5zZXSQ6jABmOowAYLT5JMCKDoHc2V0dGluZzIdL3YxL3tzZXR0aW5nLm5hbWU9c2V0dGluZ3MvKn1CqQEKD2NvbS5ieXRlYmFzZS52MUITU2V0dGluZ1NlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_issue_service, file_v1_project_service]);
/**
* Describes the message bytebase.v1.ListSettingsRequest.
@@ -122,12 +122,19 @@ export const AppIMSetting_LarkSchema = /*@__PURE__*/
export const AppIMSetting_DingTalkSchema = /*@__PURE__*/
messageDesc(file_v1_setting_service, 7, 4);
+/**
+ * Describes the message bytebase.v1.AppIMSetting.Teams.
+ * Use `create(AppIMSetting_TeamsSchema)` to create a new message.
+ */
+export const AppIMSetting_TeamsSchema = /*@__PURE__*/
+ messageDesc(file_v1_setting_service, 7, 5);
+
/**
* Describes the message bytebase.v1.AppIMSetting.IMSetting.
* Use `create(AppIMSetting_IMSettingSchema)` to create a new message.
*/
export const AppIMSetting_IMSettingSchema = /*@__PURE__*/
- messageDesc(file_v1_setting_service, 7, 5);
+ messageDesc(file_v1_setting_service, 7, 6);
/**
* Describes the message bytebase.v1.WorkspaceProfileSetting.
diff --git a/frontend/src/types/v1/projectWebhook.ts b/frontend/src/types/v1/projectWebhook.ts
index ee1c078724..d477335eae 100644
--- a/frontend/src/types/v1/projectWebhook.ts
+++ b/frontend/src/types/v1/projectWebhook.ts
@@ -48,7 +48,7 @@ export const projectWebhookV1TypeItemList = (): ProjectWebhookV1TypeItem[] => {
urlPlaceholder: "https://acme123.webhook.office.com/webhookb2/...",
docUrl:
"https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook",
- supportDirectMessage: false,
+ supportDirectMessage: true,
},
{
type: Webhook_Type.DINGTALK,
diff --git a/frontend/src/views/SettingWorkspaceIM.vue b/frontend/src/views/SettingWorkspaceIM.vue
index 301f39403b..2b5be9a034 100644
--- a/frontend/src/views/SettingWorkspaceIM.vue
+++ b/frontend/src/views/SettingWorkspaceIM.vue
@@ -17,6 +17,9 @@
type="primary"
@click="() => onAddIM(availableImSettings[0].value)"
>
+ <template #icon>
+ <PlusIcon class="h-4 w-4" />
+ </template>
{{ $t("settings.im.add-im-integration") }}
</NButton>
</template>
@@ -157,6 +160,38 @@
/>
</div>
</div>
+ <div
+ v-else-if="item.type === Webhook_Type.TEAMS"
+ class="flex flex-col gap-y-4"
+ >
+ <div>
+ <div class="textlabel">Tenant ID</div>
+ <BBTextField
+ class="mt-2"
+ :disabled="!props.allowEdit"
+ :placeholder="t('common.sensitive-placeholder')"
+ v-model:value="(item.payload.value as AppIMSetting_Teams).tenantId"
+ />
+ </div>
+ <div>
+ <div class="textlabel">Client ID</div>
+ <BBTextField
+ class="mt-2"
+ :disabled="!props.allowEdit"
+ :placeholder="t('common.sensitive-placeholder')"
+ v-model:value="(item.payload.value as AppIMSetting_Teams).clientId"
+ />
+ </div>
+ <div>
+ <div class="textlabel">Client Secret</div>
+ <BBTextField
+ class="mt-2"
+ :disabled="!props.allowEdit"
+ :placeholder="t('common.sensitive-placeholder')"
+ v-model:value="(item.payload.value as AppIMSetting_Teams).clientSecret"
+ />
+ </div>
+ </div>
</div>
<div class="flex items-center justify-between mt-4 gap-x-2">
@@ -210,6 +245,9 @@
secondary
@click="() => onAddIM(availableImSettings[0].value)"
>
+ <template #icon>
+ <PlusIcon class="h-4 w-4" />
+ </template>
{{ $t("settings.im.add-another-im") }}
</NButton>
</div>
@@ -218,10 +256,10 @@
</template>
<script lang="tsx" setup>
-import { create } from "@bufbuild/protobuf";
+import { clone, create } from "@bufbuild/protobuf";
import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
-import { cloneDeep, isEqual } from "lodash-es";
-import { Trash2Icon } from "lucide-vue-next";
+import { isEqual } from "lodash-es";
+import { PlusIcon, Trash2Icon } from "lucide-vue-next";
import { NButton, NEmpty, NPopconfirm, NSelect } from "naive-ui";
import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
@@ -242,6 +280,8 @@ import {
AppIMSetting_LarkSchema,
type AppIMSetting_Slack,
AppIMSetting_SlackSchema,
+ type AppIMSetting_Teams,
+ AppIMSetting_TeamsSchema,
type AppIMSetting_Wecom,
AppIMSetting_WecomSchema,
AppIMSettingSchema,
@@ -260,6 +300,7 @@ type IMSettingPayloadValue =
| AppIMSetting_Wecom
| AppIMSetting_Lark
| AppIMSetting_DingTalk
+ | AppIMSetting_Teams
| undefined;
const props = defineProps<{
@@ -323,6 +364,15 @@ const onAddIM = (type: Webhook_Type) => {
},
});
break;
+ case Webhook_Type.TEAMS:
+ setting = create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "teams",
+ value: create(AppIMSetting_TeamsSchema, {}),
+ },
+ });
+ break;
}
if (!setting) {
return;
@@ -359,7 +409,10 @@ const onDiscardIM = (index: number, type: Webhook_Type) => {
(setting) => setting.type === type
);
if (oldSetting) {
- state.setting.settings[index] = cloneDeep(oldSetting);
+ state.setting.settings[index] = clone(
+ AppIMSetting_IMSettingSchema,
+ oldSetting
+ );
} else {
state.setting.settings.splice(index, 1);
}
@@ -385,17 +438,99 @@ const onSaveIM = async (index: number, type: Webhook_Type) => {
case Webhook_Type.DINGTALK:
updateMask.push("value.app_im.dingtalk");
break;
+ case Webhook_Type.TEAMS:
+ updateMask.push("value.app_im_setting_value.teams");
+ break;
}
const setting = state.setting.settings[index];
const oldIndex = imSetting.value.settings.findIndex(
(setting) => setting.type === type
);
- const pendingUpdate = cloneDeep(imSetting.value);
+
+ // Reconstruct the setting with proper oneof payload to avoid Vue reactivity issues
+ const reconstructSetting = (): AppIMSetting_IMSetting => {
+ const payloadValue = setting.payload.value;
+ switch (type) {
+ case Webhook_Type.SLACK:
+ return create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "slack",
+ value: create(
+ AppIMSetting_SlackSchema,
+ payloadValue as AppIMSetting_Slack
+ ),
+ },
+ });
+ case Webhook_Type.FEISHU:
+ return create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "feishu",
+ value: create(
+ AppIMSetting_FeishuSchema,
+ payloadValue as AppIMSetting_Feishu
+ ),
+ },
+ });
+ case Webhook_Type.WECOM:
+ return create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "wecom",
+ value: create(
+ AppIMSetting_WecomSchema,
+ payloadValue as AppIMSetting_Wecom
+ ),
+ },
+ });
+ case Webhook_Type.LARK:
+ return create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "lark",
+ value: create(
+ AppIMSetting_LarkSchema,
+ payloadValue as AppIMSetting_Lark
+ ),
+ },
+ });
+ case Webhook_Type.DINGTALK:
+ return create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "dingtalk",
+ value: create(
+ AppIMSetting_DingTalkSchema,
+ payloadValue as AppIMSetting_DingTalk
+ ),
+ },
+ });
+ case Webhook_Type.TEAMS:
+ return create(AppIMSetting_IMSettingSchema, {
+ type,
+ payload: {
+ case: "teams",
+ value: create(
+ AppIMSetting_TeamsSchema,
+ payloadValue as AppIMSetting_Teams
+ ),
+ },
+ });
+ default:
+ return setting;
+ }
+ };
+
+ const reconstructedSetting = reconstructSetting();
+
+ // Use protobuf clone to properly preserve oneof discriminators
+ const pendingUpdate = clone(AppIMSettingSchema, imSetting.value);
if (oldIndex < 0) {
- pendingUpdate.settings.push(setting);
+ pendingUpdate.settings.push(reconstructedSetting);
} else {
- pendingUpdate.settings[oldIndex] = setting;
+ pendingUpdate.settings[oldIndex] = reconstructedSetting;
}
try {
await settingStore.upsertSetting({
@@ -482,6 +617,8 @@ const getImLabel = (type: Webhook_Type): string => {
return t("common.wecom");
case Webhook_Type.DINGTALK:
return t("common.dingtalk");
+ case Webhook_Type.TEAMS:
+ return t("common.teams");
default:
return "";
}
@@ -494,6 +631,7 @@ const availableImSettings = computed(() => {
Webhook_Type.LARK,
Webhook_Type.WECOM,
Webhook_Type.DINGTALK,
+ Webhook_Type.TEAMS,
]
.filter((type) => !isConfigured(type) && !isExisted(type))
.map((type) => ({
@@ -513,7 +651,7 @@ const renderOption = ({ value }: { value: Webhook_Type }) => {
watch(
() => imSetting.value,
(setting) => {
- state.setting = cloneDeep(setting);
+ state.setting = clone(AppIMSettingSchema, setting);
},
{ once: true, immediate: true }
);
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 9084fd9d1d..16f088be99 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -8193,6 +8193,8 @@ components:
$ref: '#/components/schemas/AppIMSetting_Lark'
dingtalk:
$ref: '#/components/schemas/AppIMSetting_DingTalk'
+ teams:
+ $ref: '#/components/schemas/AppIMSetting_Teams'
AppIMSetting_Lark:
type: object
properties:
@@ -8208,6 +8210,21 @@ components:
token:
writeOnly: true
type: string
+ AppIMSetting_Teams:
+ type: object
+ properties:
+ tenantId:
+ writeOnly: true
+ type: string
+ description: Azure AD tenant ID (Directory ID).
+ clientId:
+ writeOnly: true
+ type: string
+ description: Azure AD application (client) ID.
+ clientSecret:
+ writeOnly: true
+ type: string
+ description: Azure AD client secret.
AppIMSetting_Wecom:
type: object
properties:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 5a70586b51..b2eac246e0 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -267,6 +267,7 @@
- [AppIMSetting.IMSetting](#bytebase-store-AppIMSetting-IMSetting)
- [AppIMSetting.Lark](#bytebase-store-AppIMSetting-Lark)
- [AppIMSetting.Slack](#bytebase-store-AppIMSetting-Slack)
+ - [AppIMSetting.Teams](#bytebase-store-AppIMSetting-Teams)
- [AppIMSetting.Wecom](#bytebase-store-AppIMSetting-Wecom)
- [DataClassificationSetting](#bytebase-store-DataClassificationSetting)
- [DataClassificationSetting.DataClassificationConfig](#bytebase-store-DataClassificationSetting-DataClassificationConfig)
@@ -4306,6 +4307,7 @@ ISSUE_CREATE represents creating an issue. |
| wecom | [AppIMSetting.Wecom](#bytebase-store-AppIMSetting-Wecom) | | |
| lark | [AppIMSetting.Lark](#bytebase-store-AppIMSetting-Lark) | | |
| dingtalk | [AppIMSetting.DingTalk](#bytebase-store-AppIMSetting-DingTalk) | | |
+| teams | [AppIMSetting.Teams](#bytebase-store-AppIMSetting-Teams) | | |
@@ -4343,6 +4345,23 @@ ISSUE_CREATE represents creating an issue. |
+<a name="bytebase-store-AppIMSetting-Teams"></a>
+
+### AppIMSetting.Teams
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| tenant_id | [string](#string) | | Azure AD tenant ID (Directory ID). |
+| client_id | [string](#string) | | Azure AD application (client) ID. |
+| client_secret | [string](#string) | | Azure AD client secret. |
+
+
+
+
+
+
<a name="bytebase-store-AppIMSetting-Wecom"></a>
### AppIMSetting.Wecom
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 7e0cdf3f58..3cebceac73 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -1246,6 +1246,10 @@
<a href="#bytebase.store.AppIMSetting.Slack"><span class="badge">M</span>AppIMSetting.Slack</a>
</li>
+ <li>
+ <a href="#bytebase.store.AppIMSetting.Teams"><span class="badge">M</span>AppIMSetting.Teams</a>
+ </li>
+
<li>
<a href="#bytebase.store.AppIMSetting.Wecom"><span class="badge">M</span>AppIMSetting.Wecom</a>
</li>
@@ -11438,6 +11442,13 @@ But frontend can be started with a single rule easily. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>teams</td>
+ <td><a href="#bytebase.store.AppIMSetting.Teams">AppIMSetting.Teams</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
</tbody>
</table>
@@ -11500,6 +11511,44 @@ But frontend can be started with a single rule easily. </p></td>
+ <h3 id="bytebase.store.AppIMSetting.Teams">AppIMSetting.Teams</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>tenant_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Azure AD tenant ID (Directory ID). </p></td>
+ </tr>
+
+ <tr>
+ <td>client_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Azure AD application (client) ID. </p></td>
+ </tr>
+
+ <tr>
+ <td>client_secret</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Azure AD client secret. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.store.AppIMSetting.Wecom">AppIMSetting.Wecom</h3>
<p></p>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 16ae3b7a78..dd3642cb17 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -119,6 +119,7 @@
- [AppIMSetting.IMSetting](#bytebase-v1-AppIMSetting-IMSetting)
- [AppIMSetting.Lark](#bytebase-v1-AppIMSetting-Lark)
- [AppIMSetting.Slack](#bytebase-v1-AppIMSetting-Slack)
+ - [AppIMSetting.Teams](#bytebase-v1-AppIMSetting-Teams)
- [AppIMSetting.Wecom](#bytebase-v1-AppIMSetting-Wecom)
- [DataClassificationSetting](#bytebase-v1-DataClassificationSetting)
- [DataClassificationSetting.DataClassificationConfig](#bytebase-v1-DataClassificationSetting-DataClassificationConfig)
@@ -2373,6 +2374,7 @@ ProjectService manages projects that group databases and changes.
| wecom | [AppIMSetting.Wecom](#bytebase-v1-AppIMSetting-Wecom) | | |
| lark | [AppIMSetting.Lark](#bytebase-v1-AppIMSetting-Lark) | | |
| dingtalk | [AppIMSetting.DingTalk](#bytebase-v1-AppIMSetting-DingTalk) | | |
+| teams | [AppIMSetting.Teams](#bytebase-v1-AppIMSetting-Teams) | | |
@@ -2410,6 +2412,23 @@ ProjectService manages projects that group databases and changes.
+<a name="bytebase-v1-AppIMSetting-Teams"></a>
+
+### AppIMSetting.Teams
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| tenant_id | [string](#string) | | Azure AD tenant ID (Directory ID). |
+| client_id | [string](#string) | | Azure AD application (client) ID. |
+| client_secret | [string](#string) | | Azure AD client secret. |
+
+
+
+
+
+
<a name="bytebase-v1-AppIMSetting-Wecom"></a>
### AppIMSetting.Wecom
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 0d6b91b642..9b3a5e3e4e 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -625,6 +625,10 @@
<a href="#bytebase.v1.AppIMSetting.Slack"><span class="badge">M</span>AppIMSetting.Slack</a>
</li>
+ <li>
+ <a href="#bytebase.v1.AppIMSetting.Teams"><span class="badge">M</span>AppIMSetting.Teams</a>
+ </li>
+
<li>
<a href="#bytebase.v1.AppIMSetting.Wecom"><span class="badge">M</span>AppIMSetting.Wecom</a>
</li>
@@ -7262,6 +7266,13 @@ But frontend can be started with a single rule easily. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>teams</td>
+ <td><a href="#bytebase.v1.AppIMSetting.Teams">AppIMSetting.Teams</a></td>
+ <td></td>
+ <td><p> </p></td>
+ </tr>
+
</tbody>
</table>
@@ -7324,6 +7335,44 @@ But frontend can be started with a single rule easily. </p></td>
+ <h3 id="bytebase.v1.AppIMSetting.Teams">AppIMSetting.Teams</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>tenant_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Azure AD tenant ID (Directory ID). </p></td>
+ </tr>
+
+ <tr>
+ <td>client_id</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Azure AD application (client) ID. </p></td>
+ </tr>
+
+ <tr>
+ <td>client_secret</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Azure AD client secret. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.AppIMSetting.Wecom">AppIMSetting.Wecom</h3>
<p></p>
diff --git a/proto/store/store/setting.proto b/proto/store/store/setting.proto
index 39e2775221..efe72eea9d 100644
--- a/proto/store/store/setting.proto
+++ b/proto/store/store/setting.proto
@@ -229,6 +229,14 @@ message AppIMSetting {
string client_secret = 2;
string robot_code = 3;
}
+ message Teams {
+ // Azure AD tenant ID (Directory ID).
+ string tenant_id = 1;
+ // Azure AD application (client) ID.
+ string client_id = 2;
+ // Azure AD client secret.
+ string client_secret = 3;
+ }
message IMSetting {
ProjectWebhook.Type type = 1;
@@ -238,6 +246,7 @@ message AppIMSetting {
Wecom wecom = 4;
Lark lark = 5;
DingTalk dingtalk = 6;
+ Teams teams = 7;
}
}
diff --git a/proto/v1/v1/setting_service.proto b/proto/v1/v1/setting_service.proto
index 4f48388207..3a1ebaa43b 100644
--- a/proto/v1/v1/setting_service.proto
+++ b/proto/v1/v1/setting_service.proto
@@ -156,6 +156,14 @@ message AppIMSetting {
string client_secret = 2 [(google.api.field_behavior) = INPUT_ONLY];
string robot_code = 3 [(google.api.field_behavior) = INPUT_ONLY];
}
+ message Teams {
+ // Azure AD tenant ID (Directory ID).
+ string tenant_id = 1 [(google.api.field_behavior) = INPUT_ONLY];
+ // Azure AD application (client) ID.
+ string client_id = 2 [(google.api.field_behavior) = INPUT_ONLY];
+ // Azure AD client secret.
+ string client_secret = 3 [(google.api.field_behavior) = INPUT_ONLY];
+ }
message IMSetting {
Webhook.Type type = 1;
@@ -165,6 +173,7 @@ message AppIMSetting {
Wecom wecom = 4;
Lark lark = 5;
DingTalk dingtalk = 6;
+ Teams teams = 7;
}
}