1.2.2 • Published 3 years ago
moleculer-slack v1.2.2

moleculer-slack 
Send Messages to Slack API.
Install
$ npm install moleculer-slack --saveUsage
Before use please set the
SLACK_TOKENandSLACK_CHANNELenvironment 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
| Property | Type | Default | Description |
|---|---|---|---|
slackToken | String | required | Slack API Token. Visit your Slack App dashboard's main page. Click "Create App, Generate Token", then copy and paste your "API TOKEN" here. |
slackChannel | String | null | Slack 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
| Property | Type | Default | Description |
|---|---|---|---|
message | String | required | Message text |
channel | String | null | Channel name |
Results
Type: String
Methods
sendMessage
Send a slack message
Parameters
| Property | Type | Default | Description |
|---|---|---|---|
message | String | - | Body of the message |
channel | String | - | Channel name |
Results
Type: String
Test
$ npm testIn development with watching
$ npm run ciLicense
The project is available under the MIT license.
Contact
Copyright (c) 2016-2018 Ice Services