dingtalk

package
v0.0.0-...-8c01324 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotifyBaseURL     = "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"
	NotifyResultURL   = "https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult"
	GetAccessTokenURL = "https://oapi.dingtalk.com/gettoken"
	GetUserIdURL      = "https://oapi.dingtalk.com/topapi/v2/user/getbymobile"

	MsgTextType     = "text"
	MsgImageType    = "image"
	MsgVoiceType    = "voice"
	MsgFileType     = "file"
	MsgLinkType     = "link"
	MsgMarkdownType = "markdown"
)

Variables

This section is empty.

Functions

func GetAccountToken

func GetAccountToken() (at string, err error)

GetAccountToken @Description: get dingtalk account token @return err

func GetResult

func GetResult(taskId int) (resMap map[string]interface{}, err error)

Types

type Interface

type Interface interface {
	Send(msg map[string]interface{}) (result string, err error)
	SendText(content string) (result string, err error)
	SendImage(mediaId string) (result string, err error)
	SendVoice(mediaId, duration string) (result string, err error)
	SendFile(mediaId string) (result string, err error)
	SendLink(title, text, messageUrl, picUrl string) (result string, err error)
	SendMarkdown(title, text string) (result string, err error)
}

func New

func New(userIdList, deptIdList string, toAllUser bool) Interface

type UserIdResponse

type UserIdResponse struct {
	RequestID string `json:"request_id"`
	ErrCode   int    `json:"errcode"`
	ErrMsg    string `json:"errmsg"`
	Result    struct {
		UserID                     string   `json:"userid"`
		ExclusiveAccountUserIDList []string `json:"exclusive_account_userid_list"`
	} `json:"result"`
}

func GetDingtalkUserId

func GetDingtalkUserId(mobile string) (res UserIdResponse, err error)

GetDingtalkUserId @Description: obtain the user ID of DingTalk users through their phone number, and enterprise applications need to have this interface permission, https://open.dingtalk.com/document/orgapp/obtain-the-userid-of-your-mobile-phone-number @param mobile phone number @return res return results @return err error message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL