slack-real-time-messaging
v1.0.0-beta.3
Published
The Slack Real Time Messaging module is a WebSocket-based API that allows you to create advanced Slack Bots to send and receive messages in real time.
Downloads
1
Readme
The Slack Real Time Messaging module is a WebSocket-based API that allows you to create advanced Slack Bots to send and receive messages in real time.
≪ Documentation · My other Modules · Buy me a Coffee ≫
Made with ♥ by Jeffrey Lanters
Hard work in progress!!
This package is currently is developement. You can use the beta version to test the current build, but keep in mind future changes may be made. Thanks for testing!
Installation
Install using npm.
$ npm install [email protected]
Example usage
IN DEVELOPMENT
const rtmClient = new RTMClient({
token: "..."
});
rtmClient.addListener("start", async _slack => {
const _user = await rtmClient.getUser("jeffrey2");
rtmClient.postMessageToUser(
"jeffrey2",
_user.is_admin ? "Hey boss!" : "Hey!"
);
rtmClient
.postMessageToUser("jeffrey2", "Hey!")
.then(_message => {})
.catch(_reason => {
console.log("Error");
console.log(_reason);
});
});