1.2.2 • Published 2 years ago

moleculer-slack v1.2.2

Weekly downloads
123
License
MIT
Repository
github
Last release
2 years ago

Moleculer logo

moleculer-slack NPM version

Send Messages to Slack API.

Install

$ npm install moleculer-slack --save

Usage

Before use please set the SLACK_TOKEN and SLACK_CHANNEL environment variables.

let { ServiceBroker }     = require("moleculer");
let SlackService             = require("../../index");

// Create broker
let broker = new ServiceBroker({ logger: console });

// Load my service
broker.createService({
    name: "slack",
    mixins: [SlackService]
});

// Start server
broker.start().then(() => {

    broker
        .call("slack.send", { message: "Hello Slack!" })
        .then(res => console.log("Slack message sent. Sid:", res.ts))
        .catch(console.error);

});

Settings

PropertyTypeDefaultDescription
slackTokenStringrequiredSlack API Token. Visit your Slack App dashboard's main page. Click "Create App, Generate Token", then copy and paste your "API TOKEN" here.
slackChannelStringnullSlack API Token. Visit your Slack App dashboard's main page. Add incoming webhook and create/select a channel, then copy and paste here.

Actions

send

Send a Slack Message

Parameters

PropertyTypeDefaultDescription
messageStringrequiredMessage text
channelStringnullChannel name

Results

Type: String

Methods

sendMessage

Send a slack message

Parameters

PropertyTypeDefaultDescription
messageString-Body of the message
channelString-Channel name

Results

Type: String

Test

$ npm test

In development with watching

$ npm run ci

License

The project is available under the MIT license.

Contact

Copyright (c) 2016-2018 Ice Services

@ice-services @MoleculerJS

1.2.2

2 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago