slack-attack

Use this to post pretty formatted messages to Slack

Usage no npm install needed!

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

README

:boom: Slack-Attack :metal:

Use this to as an interface to the Slack web API.

Usage

npm install slack-attack

    var SlackAttack = require('slack-attack');
    var slack = new SlackAttack('<YOUR-API-KEY>');

    var options = { 'username': 'Test Bot',
                    'icon_emoji': ':robot_face:',
                    'link_names': 1 };


    slack.chat('#<channel>', '<message>', options, function(err, posted, resp){
      console.log(err, posted, resp);
    });
  • channel: the channel you want to post to
  • message: a string to post to the channel (can be an empty string)
  • options: an object with optional attachments for Slack. This follows the same convention as Slack's documentation
  • callback: the function signature should be of the form of (err, posted, response) where err is the standard error of the request, posted is a boolean response from Slack if your message was successfully posted, and response is the body of the response from the Slack API.