Send a message to a Slack Channel
To create a Slack webhook URL:
webhookUrl
parameter.Name | Type | Description | |
---|---|---|---|
webhookUrl |
string
|
The Slack webhook URL. |
const Slack = require('vendor/Slack.js');
const slack = new Slack(Secret.get('slack-webhook-url'));
slack.send('Just a test!');
slack.send('A more advanced test', {
domain: 'mysite',
channel: '#alerts',
icon_emoji: ':+1:',
});
Void
Post a message on Slack
Name | Type | Description | |
---|---|---|---|
text |
string
|
The message text. |
|
options |
object
|
Optional | |
options.domain |
string
|
Overwrite the Slack domain configured in the webhook settings. |
Optional |
options.channel |
string
|
Overwrite the Slack channel configured in the webhook. Example: |
Optional |
options.username |
string
|
Overwrite the Slack channel configured in the webhook settings. |
Optional |
options.icon_emoji |
string
|
Set a custom emoji to use as the message icon. Example: |
Optional |
Void
Construct Slack authentication
Name | Type | Description | |
---|---|---|---|
webhookUrl |
string
|
The Slack webhook URL from __. |
Void