Documentation ¶
Index ¶
- Constants
- func BuildTokenHeader(token string) http.Header
- func Request(method httputils.THttpMethod, url string, header http.Header, ...) (jsonutils.JSONObject, error)
- type BatchMsgReq
- type BatchMsgResp
- type BatchMsgRespData
- type Card
- type CardConfig
- type CardElement
- type CardElementField
- type CardElementUrl
- type CardHeader
- type CardHeaderTitle
- type CardI18n
- type ChatGroupData
- type ChatMembersResp
- type CommonResp
- type CommonResponser
- type FileCache
- type GroupData
- type GroupListResp
- type I18nElement
- type ICache
- type IExpirable
- type MemberData
- type MsgContent
- type MsgPost
- type MsgPostContentA
- type MsgPostContentAt
- type MsgPostContentImage
- type MsgPostContentText
- type MsgPostValue
- type MsgReq
- type MsgResp
- type MsgRespData
- type Tenant
- func (t *Tenant) BatchSendMessage(msg BatchMsgReq) (*BatchMsgResp, error)
- func (t *Tenant) ChatList(pageSize int, pageToken string) (*GroupListResp, error)
- func (t *Tenant) RefreshAccessToken() error
- func (t *Tenant) SendMessage(msg MsgReq) (*MsgResp, error)
- func (t *Tenant) UserIdByMobile(mobile string) (string, error)
- type TenantAccesstoken
- type TenantAccesstokenResp
- type UserGroupListData
- type UserIDResp
- type UserIDRespData
- type WebhookRobotMsgReq
- type WebhookRobotMsgResp
Constants ¶
View Source
const ( // 获取 tenant_access_token(企业自建应用) ApiTenantAccessTokenInternal = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal/" // 获取群列表 ApiChatList = "https://open.feishu.cn/open-apis/chat/v4/list" // 机器人发送消息 ApiRobotSendMessage = "https://open.feishu.cn/open-apis/message/v4/send/" // 批量发送消息 ApiRobotBatchSendMessage = "https://open.feishu.cn/open-apis/message/v4/batch_send/" // 使用手机号或邮箱获取用户ID ApiFetchUserID = "https://open.feishu.cn/open-apis/user/v1/batch_get_id" // 使用 webhook 机器人发送消息 ApiWebhookRobotSendMessage = "https://open.feishu.cn/open-apis/bot/hook/" )
View Source
const ( MsgTypePost = "post" MsgTypeInteractive = "interactive" )
View Source
const ( TagDiv = "div" TagPlainText = "plain_text" TagImg = "img" TagNote = "note" TagLarkMd = "lark_md" TagHR = "hr" )
Variables ¶
This section is empty.
Functions ¶
func BuildTokenHeader ¶
func Request ¶
func Request(method httputils.THttpMethod, url string, header http.Header, body jsonutils.JSONObject) (jsonutils.JSONObject, error)
Types ¶
type BatchMsgReq ¶
type BatchMsgReq struct { DepartMentIds []string `json:"department_ids"` OpenIds []string `json:"open_ids"` UserIds []string `json:"user_ids"` MsgType string `json:"msg_type,omitempty"` Content *MsgContent `json:"content,omitempty"` }
type BatchMsgResp ¶
type BatchMsgResp struct { CommonResp Data BatchMsgRespData }
type BatchMsgRespData ¶
type Card ¶
type Card struct { Config *CardConfig `json:"config,omitempty"` CardLink *CardElementUrl `json:"card_link,omitempty"` Header *CardHeader `json:"header,omitempty"` I18nElements *I18nElement `json:"i18n_elements"` Elements []interface{} `json:"elements"` }
机器人消息Card字段数据格式定义
type CardConfig ¶
type CardConfig struct {
WideScreenMode bool `json:"wide_screen_mode"`
}
type CardElement ¶
type CardElement struct { Tag string `json:"tag"` Content string `json:"content"` Text *CardElement `json:"text"` Fields []*CardElementField `json:"fields"` Elements []*CardElement `json:"elements"` }
func NewCardElementHR ¶
func NewCardElementHR() *CardElement
func NewCardElementText ¶
func NewCardElementText(content string) *CardElement
type CardElementField ¶
type CardElementField struct { IsShort bool `json:"is_short"` Text *CardElement `json:"text"` }
func NewCardElementTextField ¶
func NewCardElementTextField(isShort bool, content string) *CardElementField
type CardElementUrl ¶
type CardHeader ¶
type CardHeader struct {
Title *CardHeaderTitle `json:"title,omitempty"`
}
type CardHeaderTitle ¶
type ChatGroupData ¶
type ChatGroupData struct { ChatId string `json:"chat_id"` HasMore bool `json:"has_more"` Members []MemberData `json:"members"` }
type ChatMembersResp ¶
type ChatMembersResp struct { CommonResp Data *ChatGroupData `json:"data"` }
type CommonResp ¶
func (CommonResp) GetCode ¶
func (r CommonResp) GetCode() int
func (CommonResp) GetMsg ¶
func (r CommonResp) GetMsg() string
type CommonResponser ¶
type FileCache ¶
type FileCache struct {
Path string
}
func NewFileCache ¶
func (*FileCache) Get ¶
func (c *FileCache) Get(data IExpirable) error
func (*FileCache) Set ¶
func (c *FileCache) Set(data IExpirable) error
type GroupListResp ¶
type GroupListResp struct { CommonResp Data *UserGroupListData `json:"data"` }
type I18nElement ¶
type I18nElement struct { ZhCn []interface{} `json:"zh_cn"` EnUs []interface{} `json:"en_us"` JaJp []interface{} `json:"ja_jp"` }
type ICache ¶
type ICache interface { Set(data IExpirable) error Get(data IExpirable) error }
type IExpirable ¶
type MemberData ¶
type MsgContent ¶
type MsgPost ¶
type MsgPost struct { ZhCn *MsgPostValue `json:"zh_cn,omitempty"` EnUs *MsgPostValue `json:"en_us,omitempty"` JaJp *MsgPostValue `json:"ja_jp,omitempty"` }
type MsgPostContentA ¶
type MsgPostContentAt ¶
type MsgPostContentImage ¶
type MsgPostContentText ¶
type MsgPostValue ¶
type MsgPostValue struct { Title string `json:"title"` Content interface{} `json:"content"` }
type MsgReq ¶
type MsgReq struct { OpenId string `json:"open_id,omitempty"` UserId string `json:"user_id,omitempty"` Email string `json:"email,omitempty"` ChatId string `json:"chat_id,omitempty"` MsgType string `json:"msg_type"` RootId string `json:"root_id,omitempty"` UpdateMulti bool `json:"update_multi"` Card *Card `json:"card,omitempty"` Content *MsgContent `json:"content,omitempty"` }
type MsgResp ¶
type MsgResp struct { CommonResp Data MsgRespData `json:"data"` }
type MsgRespData ¶
type MsgRespData struct {
MessageId string `json:"message_id"`
}
type Tenant ¶
func (*Tenant) BatchSendMessage ¶
func (t *Tenant) BatchSendMessage(msg BatchMsgReq) (*BatchMsgResp, error)
BatchSendMessage batch send messages. Doc: https://open.feishu.cn/document/ukTMukTMukTM/ucDO1EjL3gTNx4yN4UTM
func (*Tenant) ChatList ¶
func (t *Tenant) ChatList(pageSize int, pageToken string) (*GroupListResp, error)
func (*Tenant) RefreshAccessToken ¶
RefreshAccessToken is to get a valid access token
func (*Tenant) UserIdByMobile ¶
UserIdByMobile query the open id of user by mobile number. https://open.feishu.cn/document/ukTMukTMukTM/uUzMyUjL1MjM14SNzITN
type TenantAccesstoken ¶
type TenantAccesstoken struct { TenantAccessToken string `json:"tenant_access_token"` Expire int64 `json:"expire"` Created int64 }
func (TenantAccesstoken) CreatedAt ¶
func (t TenantAccesstoken) CreatedAt() int64
func (TenantAccesstoken) ExpiresIn ¶
func (t TenantAccesstoken) ExpiresIn() int64
type TenantAccesstokenResp ¶
type TenantAccesstokenResp struct { CommonResp TenantAccesstoken }
func GetTenantAccessTokenInternal ¶
func GetTenantAccessTokenInternal(appId string, appSecret string) (*TenantAccesstokenResp, error)
获取 tenant_access_token(企业自建应用)https://open.feishu.cn/document/ukTMukTMukTM/uIjNz4iM2MjLyYzM
type UserGroupListData ¶
type UserIDResp ¶
type UserIDResp struct { CommonResp Data UserIDRespData `json:"data"` }
type UserIDRespData ¶
type UserIDRespData struct { EmailUsers jsonutils.JSONObject `json:"email_users"` EmailsNotExist []string `json:"emails_not_exist"` MobileUsers jsonutils.JSONObject `json:"mobile_users"` MobilesNotExist []string `json:"mobiles_not_exist"` }
type WebhookRobotMsgReq ¶
type WebhookRobotMsgResp ¶
func SendWebhookRobotMessage ¶
func SendWebhookRobotMessage(hook string, msg WebhookRobotMsgReq) (*WebhookRobotMsgResp, error)
SendWebhookRobotMessage will send to message to Webhook address. Webhook's format: https://open.feishu.cn/open-apis/bot/hook/xxxxxxxxxxxxxxxxxxxxxxxxxxx. The hook represents the last part of webhook: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'.
Click to show internal directories.
Click to hide internal directories.