fd-slack

The class to connect to API slack.com

Usage no npm install needed!

<script type="module">
  import fdSlack from 'https://cdn.skypack.dev/fd-slack';
</script>

README

Node.js class for slack.com

Installation

npm install fd-slack --save

Usage Example

1) Add new bot

2) Create test app

var Slack = require('fd-slack');

var slack = new Slack('aaaa-000000000000-aaaaaaaaaaaaaaaaaaaaaaaaaa'); //Your skack bot token

slack.query('chat.postMessage', {
    channel: "#general",
    text: "Hello from *Russia*",
    parse: "full"
}, function(err, data) {
    console.log("Errors: ", err );
    console.log("Response: ", data );
});

Methods

query(method, args, callback)

  • string method - slack.com api method. Full methods list: api.slack.com/methods.
  • object args - POST data
  • callback callback - function(err, res) callback function after a request to the api