Versions in this module Expand all Collapse all v1 v1.7.6 May 6, 2023 v1.7.5 May 6, 2023 Changes in this version + const ChatBot + const DomainFeishu + const DomainLark + const EventGetMessage + const EventTypeBotAdded + const EventTypeBotDeleted + const EventTypeChatDisbanded + const EventTypeChatUpdated + const EventTypeMessageRead + const EventTypeMessageReceived + const EventTypeUserAdded + const EventTypeUserDeleted + const EventTypeUserWithdrawn + const LocaleEnUS + const LocaleJaJP + const LocaleZhCN + const LogLevelDebug + const LogLevelError + const LogLevelInfo + const LogLevelTrace + const LogLevelWarn + const MsgAudio + const MsgFile + const MsgImage + const MsgInteractive + const MsgMedia + const MsgPost + const MsgShareCard + const MsgShareUser + const MsgSticker + const MsgText + const NotificationBot + const UIDChatID + const UIDEmail + const UIDOpenID + const UIDUnionID + const UIDUserID + var ErrBotTypeError = errors.New("Bot type error") + var ErrCustomHTTPClientNotSet = errors.New("Custom HTTP client not set") + var ErrEncryptionNotEnabled = errors.New("Encryption is not enabled") + var ErrEventTypeNotMatch = errors.New("Event type not match") + var ErrInvalidReceiveID = errors.New("Invalid receive ID") + var ErrMessageNotBuild = errors.New("Message not build") + var ErrMessageType = errors.New("Message type error") + var ErrMessageTypeNotSuppored = errors.New("Message type not supported") + var ErrParamMessageID = errors.New("Param error: Message ID") + var ErrParamUserID = errors.New("Param error: UserID") + var ErrUnsupportedUIDType = errors.New("Unsupported UID type") + func BuildOutcomingMessageReq(om OutcomingMessage) map[string]interface + func Decrypt(encryptedKey []byte, data string) ([]byte, error) + func DownloadFile(path, url string) error + func EncryptKey(key string) []byte + func GenSign(secret string, timestamp int64) (string, error) + func PostEvent(client *http.Client, hookURL string, message EventMessage) (*http.Response, error) + type AddBotToGroupResponse = BaseResponse + type AddChatMemberRequest struct + IDList []string + type AddChatMemberResponse struct + Data struct{ ... } + type AddGroupMemberResponse struct + InvalidOpenID []string + type AudioContent struct + FileKey string + type AuthTokenInternalResponse struct + AppAccessToken string + Expire int + type BaseResponse struct + Code int + Msg string + type Bot struct + func NewChatBot(appID, appSecret string) *Bot + func NewNotificationBot(hookURL string) *Bot + func (bot *Bot) AddBotToGroup(openChatID string) (*AddBotToGroupResponse, error) + func (bot *Bot) AddGroupMember(openChatID string, openID []string) (*AddGroupMemberResponse, error) + func (bot *Bot) AddGroupMemberByUserID(openChatID string, userID []string) (*AddGroupMemberResponse, error) + func (bot *Bot) CreateGroup(name, description string, openID []string) (*CreateGroupResponse, error) + func (bot *Bot) DeleteGroupMember(openChatID string, openID []string) (*DeleteGroupMemberResponse, error) + func (bot *Bot) DisbandGroup(openChatID string) (*DisbandGroupResponse, error) + func (bot *Bot) GetAccessTokenInternal(updateToken bool) (*AuthTokenInternalResponse, error) + func (bot *Bot) GetBotInfo() (*GetBotInfoResponse, error) + func (bot *Bot) GetGroupInfo(openChatID string) (*GroupInfoResponse, error) + func (bot *Bot) GetGroupList(pageNum, pageSize int) (*GroupListResponse, error) + func (bot *Bot) GetTenantAccessTokenInternal(updateToken bool) (*TenantAuthTokenInternalResponse, error) + func (bot *Bot) PostNotification(title, text string) (*PostNotificationResp, error) + func (bot *Bot) PostNotificationV2(om OutcomingMessage) (*PostNotificationV2Resp, error) + func (bot *Bot) RemoveBotFromGroup(openChatID string) (*RemoveBotFromGroupResponse, error) + func (bot *Bot) SetClient(c *http.Client) + func (bot *Bot) SetCustomClient(c HTTPWrapper) + func (bot *Bot) SetDomain(domain string) + func (bot *Bot) SetLogger(logger LogWrapper) + func (bot *Bot) SetWebhook(url string) + func (bot *Bot) StartHeartbeat() error + func (bot *Bot) StopHeartbeat() + func (bot *Bot) UnsetCustomClient() + func (bot *Bot) UpdateGroupInfo(params *UpdateGroupInfoReq) (*UpdateGroupInfoResponse, error) + func (bot *Bot) WithContext(ctx context.Context) *Bot + func (bot *Bot) WithUserIDType(userIDType string) *Bot + func (bot Bot) AccessToken() string + func (bot Bot) AddChatMember(chatID string, idList []string) (*AddChatMemberResponse, error) + func (bot Bot) AppID() string + func (bot Bot) BotType() int + func (bot Bot) CreateChat(req CreateChatRequest) (*CreateChatResponse, error) + func (bot Bot) DeleteAPIRequest(prefix, urlPath string, auth bool, params interface{}, output interface{}) error + func (bot Bot) DeleteChat(chatID string) (*DeleteChatResponse, error) + func (bot Bot) DeleteEphemeralMessage(messageID string) (*DeleteEphemeralMessageResponse, error) + func (bot Bot) DoAPIRequest(method string, prefix, urlPath string, header http.Header, auth bool, ...) error + func (bot Bot) Domain() string + func (bot Bot) ExpandURL(urlPath string) string + func (bot Bot) GetAPIRequest(prefix, urlPath string, auth bool, params interface{}, output interface{}) error + func (bot Bot) GetChat(chatID string) (*GetChatResponse, error) + func (bot Bot) GetChatMembers(chatID string, pageToken string, pageSize int) (*GetChatMembersResponse, error) + func (bot Bot) GetMessage(messageID string) (*GetMessageResponse, error) + func (bot Bot) IsInChat(chatID string) (*IsInChatResponse, error) + func (bot Bot) JoinChat(chatID string) (*JoinChatResponse, error) + func (bot Bot) Logger() LogWrapper + func (bot Bot) MessageReadReceipt(messageID string) (*MessageReceiptResponse, error) + func (bot Bot) PatchAPIRequest(prefix, urlPath string, auth bool, params interface{}, output interface{}) error + func (bot Bot) PostAPIRequest(prefix, urlPath string, auth bool, params interface{}, output interface{}) error + func (bot Bot) PostEphemeralMessage(om OutcomingMessage) (*PostEphemeralMessageResponse, error) + func (bot Bot) PostImage(imageKey string, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostMessage(om OutcomingMessage) (*PostMessageResponse, error) + func (bot Bot) PostRichText(postContent *PostContent, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostShareChat(chatID string, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostShareUser(openID string, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostText(text string, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostTextMention(text string, atUserID string, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostTextMentionAll(text string, userID *OptionalUserID) (*PostMessageResponse, error) + func (bot Bot) PostTextMentionAndReply(text string, atUserID string, userID *OptionalUserID, replyID string) (*PostMessageResponse, error) + func (bot Bot) PutAPIRequest(prefix, urlPath string, auth bool, params interface{}, output interface{}) error + func (bot Bot) RecallMessage(messageID string) (*RecallMessageResponse, error) + func (bot Bot) RemoveChatMember(chatID string, idList []string) (*RemoveChatMemberResponse, error) + func (bot Bot) ReplyMessage(om OutcomingMessage) (*PostMessageResponse, error) + func (bot Bot) TenantAccessToken() string + func (bot Bot) UpdateChat(chatID string, req UpdateChatRequest) (*UpdateChatResponse, error) + func (bot Bot) UpdateMessage(messageID string, om OutcomingMessage) (*UpdateMessageResponse, error) + func (bot Bot) UploadFile(req UploadFileRequest) (*UploadFileResponse, error) + func (bot Bot) UploadImage(path string) (*UploadImageResponse, error) + func (bot Bot) UploadImageObject(img image.Image) (*UploadImageResponse, error) + type CardBlock = card.Block + type CardBuilder interface + Action func(actions ...card.Element) *card.ActionBlock + Button func(text *card.TextBlock) *card.ButtonBlock + Card func(elements ...card.Element) *CardBlock + Confirm func(title, text string) *card.ConfirmBlock + DatePicker func() *card.DatePickerBlock + DatetimePicker func() *card.DatetimePickerBlock + Div func(fields ...*card.FieldBlock) *card.DivBlock + Field func(text *card.TextBlock) *card.FieldBlock + Hr func() *card.HrBlock + Img func(key string) *card.ImgBlock + Markdown func(s string) *card.MarkdownBlock + Note func() *card.NoteBlock + Option func(value string) *card.OptionBlock + Overflow func(options ...*card.OptionBlock) *card.OverflowBlock + SelectMenu func(options ...*card.OptionBlock) *card.SelectMenuBlock + Text func(s string) *card.TextBlock + TimePicker func() *card.TimePickerBlock + URL func() *card.URLBlock + func NewCardBuilder() CardBuilder + type CardContent map[string]interface + type ChatInfo struct + AddMemberPermission string + AtAllPermission string + Avatar string + ChatID string + ChatMode string + ChatTag string + ChatType string + Description string + EditPermission string + External bool + I18NNames I18NNames + JoinMessageVisibility string + LeaveMessageVisibility string + MembershipApproval string + ModerationPermission string + Name string + OwnerID string + OwnerIDType string + ShareCardPermission string + type ChatMember struct + MemberID string + MemberIDType string + Name string + TenantKey string + type CreateChatRequest struct + Avatar string + ChatMode string + ChatType string + Description string + External bool + I18NNames I18NNames + JoinMessageVisibility string + LeaveMessageVisibility string + MembershipApproval string + Name string + OwnerID string + type CreateChatResponse struct + Data ChatInfo + type CreateGroupResponse struct + InvalidOpenID []string + OpenChatID string + type DeleteChatResponse struct + type DeleteEphemeralMessageResponse = BaseResponse + type DeleteGroupMemberResponse AddGroupMemberResponse + type DisbandGroupResponse = BaseResponse + type EncryptedReq struct + Encrypt string + type EventBody struct + AppID string + ChatType string + FileKey string + ImageKey string + ImageURL string + IsMention bool + MsgType string + OpenChatID string + OpenID string + OpenMessageID string + ParentID string + RealText string + RootID string + TenantKey string + Text string + Title string + Type string + type EventChallengeReq struct + Challenge string + Token string + Type string + type EventMessage struct + Event EventBody + EventType string + Timestamp string + Token string + UUID string + type EventV2 struct + Event interface{} + EventRaw json.RawMessage + Header EventV2Header + Schema string + func (e EventV2) GetBotAdded() (*EventV2BotAdded, error) + func (e EventV2) GetBotDeleted() (*EventV2BotDeleted, error) + func (e EventV2) GetChatDisbanded() (*EventV2ChatDisbanded, error) + func (e EventV2) GetEvent(eventType string, body interface{}) error + func (e EventV2) GetMessageRead() (*EventV2MessageRead, error) + func (e EventV2) GetMessageReceived() (*EventV2MessageReceived, error) + func (e EventV2) GetUserAdded() (*EventV2UserAdded, error) + func (e EventV2) GetUserDeleted() (*EventV2UserDeleted, error) + func (e EventV2) PostEvent(client *http.Client, hookURL string, event EventV2) (*http.Response, error) + type EventV2BotAdded struct + ChatID string + External bool + OperatorID EventV2UserID + OperatorTenantKey string + type EventV2BotDeleted = EventV2BotAdded + type EventV2ChatDisbanded struct + ChatID string + External bool + OperatorID EventV2UserID + OperatorTenantKey string + type EventV2Header struct + AppID string + CreateTime string + EventID string + EventType string + TenantKey string + Token string + type EventV2MessageRead struct + MessageIDList []string + Reader struct{ ... } + type EventV2MessageReceived struct + Message struct{ ... } + Sender struct{ ... } + type EventV2UserAdded struct + ChatID string + External bool + OperatorID EventV2UserID + OperatorTenantKey string + Users []struct{ ... } + type EventV2UserDeleted = EventV2UserAdded + type EventV2UserID struct + OpenID string + UnionID string + UserID string + type FileContent struct + FileKey string + FileName string + type GetBotInfoResponse struct + Bot struct{ ... } + type GetChatMembersResponse struct + Data struct{ ... } + type GetChatResponse struct + Data ChatInfo + type GetMessageResponse struct + Data struct{ ... } + type GroupInfoResponse struct + Data struct{ ... } + type GroupListResponse struct + Chats []struct{ ... } + HasMore bool + type HTTPWrapper interface + Do func(ctx context.Context, method, url string, header http.Header, body io.Reader) (io.ReadCloser, error) + type I18NNames struct + EnUS string + JaJP string + ZhCN string + type IMBody struct + Content string + type IMMention struct + ID string + IDType string + Key string + Name string + type IMMessage struct + Body IMBody + ChatID string + CreateTime string + Deleted bool + Mentions []IMMention + MessageID string + MsgType string + ParentID string + RootID string + Sendor IMSendor + UpdateTime string + Updated bool + UpperMessageID string + type IMMessageRequest struct + Content string + MsgType string + ReceiveID string + UUID string + func BuildMessage(om OutcomingMessage) (*IMMessageRequest, error) + type IMSendor struct + ID string + IDType string + SendorType string + TenantKey string + type ImageContent struct + ImageKey string + type IsInChatResponse struct + Data struct{ ... } + type JoinChatResponse struct + type LogLevel int + func (ll LogLevel) String() string + type LogWrapper interface + Log func(context.Context, LogLevel, string) + SetOutput func(io.Writer) + type MediaContent struct + Duration int + FileKey string + FileName string + ImageKey string + type MessageContent struct + Audio *AudioContent + Card *CardContent + File *FileContent + Image *ImageContent + Media *MediaContent + Post *PostContent + ShareChat *ShareChatContent + ShareUser *ShareUserContent + Sticker *StickerContent + Text *TextContent + type MessageReceiptResponse struct + Data struct{ ... } + type MsgBuffer struct + func NewMsgBuffer(newMsgType string) *MsgBuffer + func (m *MsgBuffer) Audio(fileKey string) *MsgBuffer + func (m *MsgBuffer) BindChatID(chatID string) *MsgBuffer + func (m *MsgBuffer) BindEmail(email string) *MsgBuffer + func (m *MsgBuffer) BindOpenChatID(openChatID string) *MsgBuffer + func (m *MsgBuffer) BindOpenID(openID string) *MsgBuffer + func (m *MsgBuffer) BindReply(rootID string) *MsgBuffer + func (m *MsgBuffer) BindUnionID(unionID string) *MsgBuffer + func (m *MsgBuffer) BindUserID(userID string) *MsgBuffer + func (m *MsgBuffer) Build() OutcomingMessage + func (m *MsgBuffer) Card(cardContent string) *MsgBuffer + func (m *MsgBuffer) Clear() *MsgBuffer + func (m *MsgBuffer) Error() error + func (m *MsgBuffer) File(fileKey string) *MsgBuffer + func (m *MsgBuffer) Image(imageKey string) *MsgBuffer + func (m *MsgBuffer) Media(fileKey, imageKey string) *MsgBuffer + func (m *MsgBuffer) Post(postContent *PostContent) *MsgBuffer + func (m *MsgBuffer) ShareChat(chatID string) *MsgBuffer + func (m *MsgBuffer) ShareUser(userID string) *MsgBuffer + func (m *MsgBuffer) Sticker(fileKey string) *MsgBuffer + func (m *MsgBuffer) Text(text string) *MsgBuffer + func (m *MsgBuffer) UpdateMulti(flag bool) *MsgBuffer + func (m *MsgBuffer) WithSign(secret string, ts int64) *MsgBuffer + func (m *MsgBuffer) WithUUID(uuid string) *MsgBuffer + type MsgPostBuilder struct + func NewPostBuilder() *MsgPostBuilder + func (pb *MsgPostBuilder) AtTag(text, userID string) *MsgPostBuilder + func (pb *MsgPostBuilder) Clear() + func (pb *MsgPostBuilder) CurLocale() *PostBuf + func (pb *MsgPostBuilder) ImageTag(imageKey string, imageWidth, imageHeight int) *MsgPostBuilder + func (pb *MsgPostBuilder) LinkTag(text, href string) *MsgPostBuilder + func (pb *MsgPostBuilder) Locale(locale string) *MsgPostBuilder + func (pb *MsgPostBuilder) Render() *PostContent + func (pb *MsgPostBuilder) TextTag(text string, lines int, unescape bool) *MsgPostBuilder + func (pb *MsgPostBuilder) Title(title string) *MsgPostBuilder + func (pb *MsgPostBuilder) WithLocale(locale string) *MsgPostBuilder + func (pb MsgPostBuilder) Len() int + type MsgTextBuilder struct + func NewTextBuilder() *MsgTextBuilder + func (tb *MsgTextBuilder) Clear() + func (tb *MsgTextBuilder) Mention(userID string) *MsgTextBuilder + func (tb *MsgTextBuilder) MentionAll() *MsgTextBuilder + func (tb *MsgTextBuilder) Render() string + func (tb *MsgTextBuilder) Text(text ...interface{}) *MsgTextBuilder + func (tb *MsgTextBuilder) Textf(textFmt string, text ...interface{}) *MsgTextBuilder + func (tb *MsgTextBuilder) Textln(text ...interface{}) *MsgTextBuilder + func (tb MsgTextBuilder) Len() int + type OptionalUserID struct + RealID string + UIDType string + func WithChatID(chatID string) *OptionalUserID + func WithEmail(email string) *OptionalUserID + func WithOpenID(openID string) *OptionalUserID + func WithUnionID(unionID string) *OptionalUserID + func WithUserID(userID string) *OptionalUserID + type OutcomingMessage struct + Card CardContent + ChatID string + Content MessageContent + Email string + MsgType string + OpenID string + RootID string + Sign string + Timestamp int64 + UIDType string + UUID string + UnionID string + UpdateMulti bool + UserID string + type PostBody struct + Content [][]PostElem + Title string + type PostBuf struct + Content []PostElem + Title string + type PostContent map[string]PostBody + type PostElem struct + Href *string + ImageHeight *int + ImageKey *string + ImageWidth *int + Lines *int + Tag string + Text *string + UnEscape *bool + UserID *string + type PostEphemeralMessageResponse struct + Data struct{ ... } + type PostMessageResponse struct + Data IMMessage + type PostNotificationResp struct + Ok bool + type PostNotificationV2Resp struct + StatusCode int + StatusMessage string + type RecallMessageResponse = BaseResponse + type RemoveBotFromGroupResponse = BaseResponse + type RemoveChatMemberRequest struct + IDList []string + type RemoveChatMemberResponse struct + Data struct{ ... } + type ShareChatContent struct + ChatID string + type ShareUserContent struct + UserID string + type StickerContent struct + FileKey string + type TenantAuthTokenInternalResponse struct + Expire int + TenantAppAccessToken string + type TextContent struct + Text string + type UpdateChatRequest struct + AddMemberPermission string + AtAllPermission string + Avatar string + Description string + EditPermission string + I18NNames I18NNames + JoinMessageVisibility string + LeaveMessageVisibility string + MembershipApproval string + Name string + OwnerID string + ShareCardPermission string + type UpdateChatResponse struct + type UpdateGroupInfoReq struct + I18nNames map[string]string + Name string + OpenChatID string + OwnerEmployeeID string + OwnerID string + type UpdateGroupInfoResponse struct + OpenChatID string + type UpdateMessageResponse = BaseResponse + type UploadFileRequest struct + Duration int + FileName string + FileType string + Path string + type UploadFileResponse struct + Data struct{ ... } + type UploadImageResponse struct + Data struct{ ... }