DingTalk (dingding) is the go implementation of the DingTalk robot. DingTalk(dingding) 是钉钉机器人的 go 实现

Overview

dingtalk

Go codecov Go Report Card Release GoDoc

English

DingTalk(dingding) 是钉钉机器人的 go 实现。支持 Docker、Jenkinsfile、命令行模式,module 模式;支持加签安全设置,支持链式语法创建消息;支持文本、链接、Markdown、ActionCard、FeedCard 消息类型。

注:使用飞书的小伙伴,可以使用飞书(feishu)版

文档

钉钉文档

特性

安装

Docker 安装

docker pull catchzeng/dingtalk

二进制安装

releases 下载相应平台的二进制可执行文件,然后加入到 PATH 环境变量即可。

go get 安装

go get github.com/CatchZeng/dingtalk

使用方法

配置文件

可以在 $/HOME/.dingtalk 下创建 config.yaml 填入 access_tokensecret 默认值。

access_token: "1c53e149ba5de6597cxxxxxx0e901fdxxxxxx80b8ac141e4a75afdc44c85ca4f"
secret: "SECb90923e19e58b466481e9e7b7a5bxxxxxx4531axxxxxxad3967fb29f0eae5c68"

Docker

docker run catchzeng/dingtalk dingtalk text -t 1c53e149ba5de6597cxxxxxx0e901fdxxxxxx80b8ac141e4a75afdc44c85ca4f -s SECb90923e19e58b466481e9e7b7a5bxxxxxx4531axxxxxxad3967fb29f0eae5c68 -c "docker test"

Jenkinsfile

pipeline {
    agent {
        docker {
            image 'catchzeng/dingtalk:latest'
        }
    }
    environment {
        DING_TOKEN = '1c53e149ba5de6597cxxxxxx0e901fdxxxxxx80b8ac141e4a75afdc44c85ca4f'
        DING_SECRET = 'SECb90923e19e58b466481e9e7b7a5bxxxxxx4531axxxxxxad3967fb29f0eae5c68'
    }
    stages {
        stage('notify') {
            steps {
                sh 'dingtalk link -t ${DING_TOKEN} -s ${DING_SECRET} -i "标题" -e "信息" -u "https://catchzeng.com/" -p "https://catchzeng.com/img/avatar-hux.jpg" -a'
            }
        }
    }
}

作为 module

package main

import (
    "log"

    "github.com/CatchZeng/dingtalk"
)

func main() {
	  accessToken := "1c53e149ba5de6597cxxxxxx0e901fdxxxxxx80b8ac141e4a75afdc44c85ca4f"
    secret := "SECb90923e19e58b466481e9e7b7a5bxxxxxx4531axxxxxxad3967fb29f0eae5c68"
    client := dingtalk.NewClient(accessToken, secret)

    msg := dingtalk.NewTextMessage().SetContent("测试文本&at 某个人").SetAt([]string{"177010xxx60"}, false)
    client.Send(msg)
}

命令行工具

Demo

dingtalk text -t 1c53e149ba5de6597cxxxxxx0e901fdxxxxxx80b8ac141e4a75afdc44c85ca4f -s SECb90923e19e58b466481e9e7b7a5bxxxxxx4531axxxxxxad3967fb29f0eae5c68 -c "测试命令行 & at 某个人" -m "177010xxx60","177010xxx61"

Help

$ dingtalk -h
dingtalk is a command line tool for DingTalk

Usage:
  dingtalk [command]

Available Commands:
  actionCard  send actionCard message with DingTalk robot
  feedCard    send feedCard message with DingTalk robot
  help        Help about any command
  link        send link message with DingTalk robot
  markdown    send markdown message with DingTalk robot
  text        send text message with DingTalk robot
  version     dingtalk version

Flags:
  -m, --atMobiles strings   atMobiles
  -h, --help                help for dingtalk
  -a, --isAtAll             isAtAll
  -s, --secret string       secret
  -t, --token string        access_token

Use "dingtalk [command] --help" for more information about a command.

Stargazers

Stargazers over time

Issues
Owner
Catch Zeng
AI (Machine Learning) and DevOps enthusiast.
Catch Zeng
A general-purpose bot library inspired by Hubot but written in Go. :robot:

Joe Bot ?? A general-purpose bot library inspired by Hubot but written in Go. Joe is a library used to write chat bots in the Go programming language.

Joe Bot 430 Oct 23, 2021
Reduce maintainer fatigue by automating GitHub

derek Derek reduces fatigue for maintainers by automating governance and delegating permissions to your team and community. Follow @derekapp on Twitte

Alex Ellis 754 Oct 17, 2021
REPLbot is a Slack bot that allows you to control a REPL from within Slack.

?? REPLbot REPLbot is a Slack bot that allows you to control a REPL from within Slack. It comes with a few REPLs (Go ?? , Java, NodeJS, PHP, Python, R

Philipp C. Heckel 151 Oct 3, 2021
机器人CeobeBot的后端,使用Golang编写的API服务

机器人CeobeBot的后端,使用Golang编写的API服务

西南大学ACM实验室 6 Oct 21, 2021
Slack bot core/framework written in Go with support for reactions to message updates/deletes

Overview Requirements Features Demo The Name Concepts Create Your Own Slackscot Assembling the Parts and Bringing Your slackscot to Life Configuration

Alexandre Normand 46 Aug 15, 2021
Full-native go implementation of Telegram API

MTProto Full-native implementation of MTProto protocol on Golang! english русский 简体中文 Features Full native implementation All code, from sending requ

Xelaj technologies 697 Oct 19, 2021
Simple yet customizable bot framework written in Go.

Introduction Sarah is a general-purpose bot framework named after the author's firstborn daughter. This comes with a unique feature called "stateful c

Go Hagiwara 205 Oct 17, 2021
Gort is a chatbot framework designed from the ground up for chatops.

Gort Gort is considered "minimally viable", but is still a work in progress under active heavy development. Follow for updates! Gort is a chatbot fram

Gort 344 Oct 14, 2021
A golang implementation of a console-based trading bot for cryptocurrency exchanges

Golang Crypto Trading Bot A golang implementation of a console-based trading bot for cryptocurrency exchanges. Usage Download a release or directly bu

Alessandro Sanino 622 Oct 22, 2021
Telebot is a Telegram bot framework in Go.

Telebot "I never knew creating Telegram bots could be so sexy!" go get -u gopkg.in/tucnak/telebot.v2 Overview Getting Started Poller Commands Files Se

Ian P Badtrousers 2.2k Oct 22, 2021
The Tenyks IRC bot.

Tenyks is a computer program designed to relay messages between connections to IRC networks and custom built services written in any number of languages.

Kyle Terry 171 Sep 3, 2021
The modern cryptocurrency trading bot written in Go.

bbgo A trading bot framework written in Go. The name bbgo comes from the BB8 bot in the Star Wars movie. aka Buy BitCoin Go! Current Status Features E

Yo-An Lin 357 Oct 18, 2021
A modern IRC server (daemon/ircd) written in Go.

Oragono is a modern IRC server written in Go. Its core design principles are: Being simple to set up and use Combining the features of an ircd, a serv

Oragono 1.4k Oct 21, 2021
CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility

CryptoPump is a cryptocurrency trading bot that focuses on high speed and flexibility. The algorithms utilize Go Language and WebSockets to react in real-time to market movements based on Bollinger statistical analysis and pre-defined profit margins.

null 15 Oct 22, 2021
Golang Implementation of RLBot

RLBotGo This repository holds a library for making Rocket League bots in Go! It provides: An easy to use interface for writing bots An example bot usi

Trey Moller 4 Sep 24, 2021
WIP Telegram Bot API server in Go

botapi The telegram-bot-api, but in go. WIP. Reference: https://core.telegram.org/bots/api Reference implementation: https://github.com/tdlib/telegram

gotd 6 Oct 11, 2021
Route changes tracking from the MosGorTrans website

example-telegram-bot Example bot template for Telegram. Description With this type of setup all you need to do is: go get the bot (or git clone it) ad

Ilya Danilkin 1 Oct 21, 2021