slack-real-time-messaging

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.

Usage no npm install needed!

<script type="module">
  import slackRealTimeMessaging from 'https://cdn.skypack.dev/slack-real-time-messaging';
</script>

README


npm npm npm npm npm

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 slack-real-time-messaging@1.0.0-beta.3

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);
    });
});