向Rocket.Chat推送消息

2020-11-13 20:01:39

如何从后台访问接口,向Rocket.Chat推送消息

参考地址 https://www.cnblogs.com/zzhaolei/p/11068204.html

Rocket.Chat推送消息 Rocket.Chat是一个开源实时通讯平台, 支持Windows, Mac OS, Linux. 支持聊天, 文件上传, 视频通话, 语音通话功能. 向Rocket.Chat推送消息 以下示例可以转为别的语言的版本, 本示例使用Linux平台的curl测试, curl非常强大. 登陆 首先需要登陆Rocket.Chat服务器: curl http://localhost:3000/api/v1/login -d "username=YourUserName&password=YourPassWord" # 会返回一个json数据, 包含了userId和Token { "status": "success", "data": { "userId": "YourUserID", "authToken": "YourAuthToken" } } 发送信息 使用返回的userId和authToken, 构造新的请求: curl -H "X-Auth-Token: YourAuthToken" \ -H "X-User-Id: YourUserID" \ -H "Content-type:application/json" \ http://localhost:3000/api/v1/chat.postMessage \ -d '{ "channel": "#测试", "text": "This is a test! @all" }' # 返回, 会包含时间戳, 频道, 信息的id, 发送的用户, @的用户等信息 { "ts": 1531986688452, "channel": "#测试", "message": { "alias": "", "msg": "This is a test! @all", "attachments": [], "parseUrls": true, "groupable": false, "ts": "2018-07-19T07:51:28.447Z", "rid": "xxxxx", "u": { "_id": "YourChatId", "username": "YourChatName", "name": "xxxx" }, "unread": true, "mentions": [{ "_id": "all", "username": "all" }], "channels": [], "_updatedAt": "2018-07-19T07:51:28.448Z", "_id": "YourChatId" }, "success": true }

  • 2019-06-24 06:22:10

    Android RecyclerView嵌套的滑动冲突问题

    这是一个简单的recyclerView嵌套recyclerView的demo, 很明显,子布局应该也是可以滑动的才对,但你滑动子布局却是父布局在滑动 这就是滑动冲突

  • 2019-07-02 21:55:47

    Nginx出现500 Internal Server Error 错误的解决方案

    Nginx 500错误(Internal Server Error 内部服务器错误):500错误指的是服务器内部错误,也就是服务器遇到意外情况,而无法履行请求。 在高并发连接的情况下,Nginx是Apache服务器不错的替代品。Nginx同时也可以作为7层负载均衡服务器来使用。根据测试结果,Nginx 0.6.31 + PHP 5.2.6 (FastCGI) 可以承受3万以上的并发连接数,相当于同等环境下Apache的10倍。

  • 2019-07-09 20:23:42

    如何在windows服务器上面创建定时任务

    在Linux上面运行java程序要比在windows上面跑稳定很多,但是总有些情况下我们的程序跑在了windows上面,这就需要我们对windows server有所了解。今天给大家介绍下如何在windows服务器上面创建定时任务来定时执行java程序。