Giter VIP home page Giter VIP logo

chat's Introduction

企业微信号


一.申请企业号

  1. 以个人邮箱申请就可以, 不通过企业认证的话,有200人的限制,一般足够用了

二.获取对接权限

  1. 获取corpid
  • 登录后,我的企业 ---> 企业信息 --> CorpID

  • 将 CorpID 配置到配置文件 config.conf 内 的 CorpID

  1. 开启回调模式获取key

    • 登录后,顶部菜单[企业应用] ---> 添加应用

    • 进入新添加的应用

    • 拿到 AgentId 和 Secret

  2. 使用微信关注企业号才可以从微信收到信息,否则只能从微信企业号 APP 中收到信息

完成以上步骤后, 即可使用OpenFalcon发送信息,发送格式与 sender 符合:

tos     微信用户名
content 信息内容

OpenFalcon+ 配置:

在falcon+的 im 配置, 注意是微信企业号内的用户名称, 而不是用户个人的个人微信号

修改配置文件 https://github.com/open-falcon/falcon-plus/blob/master/modules/alarm/cfg.example.json#L25

"api": {
	"im": "http://yanjunhui.com:4567/send",
        "sms": "http://127.0.0.1:10086/sms",
        "mail": "http://127.0.0.1:10086/mail",
        "dashboard": "http://127.0.0.1:8081",
        "plus_api":"http://127.0.0.1:8080",
        "plus_api_token": "used-by-alarm-in-server-side-and-disabled-by-set-to-blank"
    },

使用

  1. clone 文件 git clone https://www.github.com/yanjunhui/chat.git
  2. 打开目录 cd chat
  3. 启动 ./control.sh start
  4. 停止 ./control.sh stop
  5. 重启 ./control.sh restart
  6. 状态 ./control.sh status

chat's People

Contributors

yanjunhui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chat's Issues

token获取失败!

已经第二次了,重启下又正常了
应该是token 机制 没弄好吧
wx20170727-102050 2x

arm平台编译后运行失败

我在arm平台重新编译(编译命令:go build main.go),然后在config.conf文件中配置了正确信息后使用./control.sh start后日志显示:
image
,后来我有在main.go中配置了cropid和secret后重新编译后又报如下错误:
image

服务不能正常运行起来。
我需要修改什么东西吗?

Index out of range

您好,我们7月份按照您文档的介绍克隆了代码,运行了3个月后,突然出现了index out of range的错误。
{"time":"2019-10-12T10:25:08.140025494+08:00","level":"-","prefix":"-","file":"main.go","line":"212","message":"微信 Token 更新成功: DAjr-pZNvNb281TQTMc7gbIWdmML_UViTwgo0ii1HVLiasZuKl6KKbQOp70XIB93v0T_4m1NSlKhXiKQMsX-TlTLkXwob2GG7S-4R13DAYn0Iv57BRDj5VMmYnKQ2hmwiPFHPhV20lbu8rPhwmK0RrHXuYj2EsDIVQw6Nv2AvByYXZFFojObLhLvcQKZLV-heK5GEM1_R1w0ihCh6uB5-A,有效时间: 7200"}
echo: http: panic serving 10.58.165.137:28625: runtime error: index out of range
goroutine 2335 [running]:
net/http.(*conn).serve.func1(0xc42039bcc0)
/usr/local/go/src/net/http/server.go:1721 +0xd0
panic(0x6fc820, 0x8d0180)
/usr/local/go/src/runtime/panic.go:489 +0x2cf
main.SendMsg(0x8b3fc0, 0xc42005e150, 0xc4201b3b68, 0x4c3a62)
/Users/yanjunhui/go/src/github.com/yanjunhui/chat/main.go:78 +0x76c
github.com/labstack/echo.(*Echo).add.func1(0x8b3fc0, 0xc42005e150, 0x8da920, 0x4)
/Users/yanjunhui/go/src/github.com/labstack/echo/echo.go:467 +0x90
github.com/labstack/echo/middleware.LoggerWithConfig.func2.1(0x8b3fc0, 0xc42005e150, 0x0, 0x0)
/Users/yanjunhui/go/src/github.com/labstack/echo/middleware/logger.go:111 +0x12b
github.com/labstack/echo.(*Echo).ServeHTTP.func1(0x8b3fc0, 0xc42005e150, 0xc42011c398, 0x756a80)
/Users/yanjunhui/go/src/github.com/labstack/echo/echo.go:558 +0x10e
github.com/labstack/echo.(*Echo).ServeHTTP(0xc42011c340, 0x8ad800, 0xc4203cc460, 0xc420298000)
/Users/yanjunhui/go/src/github.com/labstack/echo/echo.go:567 +0x24c
net/http.serverHandler.ServeHTTP(0xc4200a8580, 0x8ad800, 0xc4203cc460, 0xc420298000)
/usr/local/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc42039bcc0, 0x8add00, 0xc420320280)
/usr/local/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2668 +0x2ce
{"time":"2019-10-12T11:24:57.347413235+08:00","level":"-","prefix":"-","file":"main.go","line":"116","message":"发送信息给JiaoHongYun, 信息内容: 仓网还未配置特殊供应商信息当前环境: [dev]\r\n, 微信返
回结果: {"errcode":0,"errmsg":"ok","invaliduser":""}"}

跟Issue #8 相比,我们并没有修改任何源代码,但是我们没有开启回调模式获取key。
您能帮我们看一下原因吗?是不是使用您的网关必须要开启回调模式获取key ?

谢谢!

企业微信回调url校验失败

image

日志:

{"time":"2017-11-15T17:41:30.755375937+08:00","level":"ERROR","prefix":"echo","file":"echo.go","line":"283","message":"code=404, message=Not Found"}

{"time":"2017-11-15T17:41:30.755447609+08:00","id":"","remote_ip":"127.0.0.1","host":"127.0.0.1:4567","method":"GET","uri":"/auth/?msg_signature=4219a3a430010ed0ab4b1b863d20d7608b312ca2&timestamp=1510738890&nonce=824695764&echostr=Cw1WzELKeUI7IxjeJ5EkrBVBlKX0fXkMRzD45KsEGbntixvliJgJ3RjxZ%2BeIXL4MQnyCSGImhiG%2B0radX51h8A%3D%3D","status":404, "latency":156425,"latency_human":"156.425µs","bytes_in":0,"bytes_out":23}

faclon+发送失败了

{"time":"2017-05-19T15:42:21.050895418+08:00","level":"ERROR","prefix":"echo","file":"echo.go","line":"260","message":"code=405, message=Method Not Allowed"}

有缓存access_token吗?

https://work.weixin.qq.com/api/doc#90000/90135/91039
注意事项:
开发者需要缓存access_token,用于后续接口的调用(注意:不能频繁调用gettoken接口,否则会受到频率拦截)。当access_token失效或过期时,需要重新获取。

access_token的有效期通过返回的expires_in来传达,正常情况下为7200秒(2小时),有效期内重复获取返回相同结果,过期后获取会返回新的access_token。
由于企业微信每个应用的access_token是彼此独立的,所以进行缓存时需要区分应用来进行存储。
access_token至少保留512字节的存储空间。
企业微信可能会出于运营需要,提前使access_token失效,开发者应实现access_token失效时重新获取的逻辑。

access_token过期后自动续期

在虚拟机上测试,中间电脑休眠了一段时间后再打开,发现发送微信企业消息返回:“发送消息失败: access_token expired, hint: [1549248037_1_ea3ed0d606a24db653d533bc931d2588]”,请问可以实现token失效后自动续期的功能?

修改了main.go,重新编译可执行文件,发现falcon自带的监控项告警发送报错,但是redismon的告警可以通过微信发出来

echo: http: panic serving 127.0.0.1:36538: runtime error: index out of range
goroutine 157 [running]:
net/http.(*conn).serve.func1(0xc420180640)
/usr/lib/golang/src/net/http/server.go:1721 +0xd0
panic(0x7023e0, 0x8da480)
/usr/lib/golang/src/runtime/panic.go:489 +0x2cf
main.SendMsg(0x8be260, 0xc420176150, 0xc420034b58, 0x4c5212)
/home/work/open-falcon/chat/main.go:101 +0xdec
github.com/labstack/echo.(*Echo).Add.func1(0x8be260, 0xc420176150, 0x8e4c20, 0x7fec42475000)
/usr/lib/golang/src/github.com/labstack/echo/echo.go:479 +0x90
github.com/labstack/echo/middleware.LoggerWithConfig.func2.1(0x8be260, 0xc420176150, 0x0, 0x0)
/usr/lib/golang/src/github.com/labstack/echo/middleware/logger.go:116 +0x12b
github.com/labstack/echo.(*Echo).ServeHTTP.func1(0x8be260, 0xc420176150, 0xc42007b238, 0x75cea0)
/usr/lib/golang/src/github.com/labstack/echo/echo.go:576 +0x10e
github.com/labstack/echo.(*Echo).ServeHTTP(0xc42007b1e0, 0x8b7960, 0xc4201aa540, 0xc42015e100)
/usr/lib/golang/src/github.com/labstack/echo/echo.go:585 +0x2a9
net/http.serverHandler.ServeHTTP(0xc4200a4420, 0x8b7960, 0xc4201aa540, 0xc42015e100)
/usr/lib/golang/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc420180640, 0x8b7fa0, 0xc420326240)
/usr/lib/golang/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
/usr/lib/golang/src/net/http/server.go:2668 +0x2ce

上面是报错,请问这是什么原因呢?

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.