使用 rocketChat API 向某人的 rocketChat 帐户发送直接消息
Send a direct message to someone's rocketChat account using rocketChat API
是否可以使用 RocketChat API (RocketChat Rest API) 从我的 RocketChat 帐户向另一个帐户发送直接消息?
我查看了 API 文档,但没有找到我需要的内容。
我使用了以下代码:
let RocketChat = require('rocketchat-nodejs').Client;
let Client = new RocketChat({
host: 'myHost',
port: 80,
scheme: 'http',
username: 'myUser',
password: 'myPass'
});
let Authentication = Client.Authentication();
let Users = Client.Users();
let Chat = Client.Chat();
Client.login().then(() => {
Authentication.me().then((result) => {
Users.list({ userId: 'muUser' }).then((result) => {
var list = result;
Chat.postMessage({ roomId: list.users[0]._id, text: 'test'})
.then((result) => {
})
});
});
}).catch((error) => {
console.log(error);
});
是否可以使用 RocketChat API (RocketChat Rest API) 从我的 RocketChat 帐户向另一个帐户发送直接消息?
我查看了 API 文档,但没有找到我需要的内容。
我使用了以下代码:
let RocketChat = require('rocketchat-nodejs').Client;
let Client = new RocketChat({
host: 'myHost',
port: 80,
scheme: 'http',
username: 'myUser',
password: 'myPass'
});
let Authentication = Client.Authentication();
let Users = Client.Users();
let Chat = Client.Chat();
Client.login().then(() => {
Authentication.me().then((result) => {
Users.list({ userId: 'muUser' }).then((result) => {
var list = result;
Chat.postMessage({ roomId: list.users[0]._id, text: 'test'})
.then((result) => {
})
});
});
}).catch((error) => {
console.log(error);
});