# README
DingTalk Open API golang SDK
Check out DingTalk Open API document at: https://ding-doc.dingtalk.com/
Usage
Fetch the SDK
export GOPATH=`pwd`
go get github.com/hugozhu/godingtalk
Example code to send a micro app message
package main
import (
"github.com/hugozhu/godingtalk"
"log"
"os"
)
func main() {
c := godingtalk.NewDingTalkClient(os.Getenv("corpid"), os.Getenv("corpsecret"))
c.RefreshAccessToken()
err := c.SendAppMessage(os.Args[1], os.Args[2], os.Args[3])
if err != nil {
log.Println(err)
}
}
Guide
Step-by-step Guide to use this SDK
http://hugozhu.myalert.info/2016/05/02/66-use-dingtalk-golang-sdk-to-send-message-on-pi.html
Tools
ding_alert : Command line tool to send app/text/oa ... messages
export GOPATH=`pwd`
go get github.com/hugozhu/godingtalk/demo/ding_alert
export corpid=<组织的corpid 通过 https://oa.dingtalk.com 获取>
export corpsecret=<组织的corpsecret 通过 https://oa.dingtalk.com 获取>
./bin/ding_alert
Usage of ./bin/ding_alert:
-agent string
agent Id (default "22194403")
-chat string
chat id (default "chat6a93bc1ee3b7d660d372b1b877a9de62")
-file string
file path for media message
-link string
link url (default "http://hugozhu.myalert.info/dingtalk")
-sender string
sender id (default "011217462940")
-text string
text for link message (default "This is link text")
-title string
title for link message (default "This is link title")
-touser string
touser id (default "0420506555")
-type string
message type (app, text, image, voice, link, oa) (default "app")
github: Deliver Github webhook events to DingTalk, which can be deployed on Google AppEngine.
more info at: http://hugozhu.myalert.info/2016/05/15/67-use-free-google-cloud-service-to-deliver-github-webhook-events-to-dingtalk.html
export GOPATH=`pwd`
go get github.com/hugozhu/godingtalk/demo/github/appengine
Modify app.yaml
cd src/github.com/hugozhu/godingtalk/demo/github/appengine
cat app.yaml
application: github-alert-<random_number>
version: 1
runtime: go
api_version: go1
env_variables:
CORP_ID: '<从 http://oa.dingtalk.com 获取>'
CORP_SECRET: '<从 http://oa.dingtalk.com 获取>'
GITHUB_WEBHOOK_SECRET: '<从 http://github.com/ 获取>'
SENDER_ID: '<从 http://open.dingtalk.com 调用api获取>'
CHAT_ID: '<从 http://open.dingtalk.com 调用api获取>'
handlers:
- url: /.*
script: _go_app
# Functions
token 数据签名需要用到的token,ISV(服务提供商)推荐使用注册套件时填写的token,普通企业可以随机填写
aesKey 数据加密密钥。用于回调数据的加密,长度固定为43个字符,从a-z, A-Z, 0-9共62个字符中选取,您可以随机生成,ISV(服务提供商)推荐使用注册套件时填写的EncodingAESKey
suiteKey 一般使用corpID
*/.
NewDingTalkClient creates a DingTalkClient instance.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Sign is 签名.
# Variables
No description provided by the author
# Structs
AccessTokenResponse is.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DataMessage 服务端加密、解密消息.
No description provided by the author
No description provided by the author
DingTalkClient is the Client to access DingTalk Open API.
DownloadFile is for downloading a single file from DingTalk.
No description provided by the author
No description provided by the author
FileResponse is.
No description provided by the author
JsAPITicketResponse is.
No description provided by the author
No description provided by the author
MediaResponse is.
MessageResponse is.
MessageResponse is.
OAMessage is the Message for OA.
No description provided by the author
No description provided by the author
OAPIResponse is.
No description provided by the author
No description provided by the author
No description provided by the author
获取用户授权的持久授权码返回信息.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
UploadFile is for uploading a single file to DingTalk.
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
Unmarshallable is.