Giter Site home page Giter Site logo

gowechat's Introduction

golang推送企业微信应用消息


实现了企业微信各种应用推送消接口


  1. 安装
go get github.com/wms3001/goWeChat
  1. 获取access_token
goWeChat.Url = "https://qyapi.weixin.qq.com"
goWeChat.Corpid = ""
goWeChat.Corpsecret = ""
token := goWeChat.GetAccessToken()
log.Println(token.AccessToken)
  1. 发送文本消息
message := model.TextMessage{}
message.Touser = "qy01669528189220079ce2e58dd8"
message.Agentid = 1000005
message.Msgtype = "text"
message.Safe = 0
message.EnableIdTrans = 0
message.EnableDuplicateCheck = 0
message.DuplicateCheckInterval = 1000
message.Totag = ""
message.Toparty = ""
message.Text.Content = "This is a Test!"
res := goWeChat.SendTextMessage(message)
log.Println(fmt.Sprint(res.Errcode) + res.Errmsg)
  1. 发送markdown消息
message := model.MarkdownMessage{}
message.Touser = "qy01669528189220079ce2e58dd8"
message.Agentid = 1000005
message.Msgtype = "markdown"
message.Safe = 0
message.EnableIdTrans = 0
message.EnableDuplicateCheck = 0
message.DuplicateCheckInterval = 1000
message.Totag = ""
message.Toparty = ""
message.Markdown.Content = "# 您的会议室已经预定,稍后会同步到`邮箱` \n                                >**事项详情** \n                                >事 项:<font color=\"info\">开会</font> \n                                >组织者:@miglioguan \n                                >参与者:@miglioguan、@kunliu、@jamdeezhou、@kanexiong、@kisonwang \n                                > \n                                >会议室:<font color=\"info\">广州TIT 1楼 301</font> \n                                >日 期:<font color=\"warning\">2018年5月18日</font> \n                                >时 间:<font color=\"comment\">上午9:00-11:00</font> \n                                > \n                                >请准时参加会议。 \n                                > \n                                >如需修改会议信息,请点击:[修改会议信息](https://work.weixin.qq.com)"
res := goWeChat.SendMarkDownMessage(message)

gowechat's People

Contributors

wms3001 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.