It's essential that an alerting and notification system send all the information you need to quickly determine what action to take, with this thing in mind, people are using Slack to send a notification to their team about any events that happen in their app, e.g website down, reminder, etc.
With SlashApi, you can send notifications to your Slack channel using REST API, without having to bother with configuration and server setup.
After you create an account and log in to the dashboard, choose Slack on the collections page. To make Slack API you have to provide your app OAuth token from your Slack app.
To get your OAuth token you need to create a Slack app if you don't already have one, or select an existing app you've created.
Configure your app's scopes and settings from scratch
Then, you need to fill in a form and choose a workspace you want to add your app to.
Configure permissions to allow your app to interact with the Slack API. You can configure permissions by click the Permissions link under "Add features and functionality" section or Click the OAuth & Permissions tab in the left sidebar.
Minimum permissions to allow SlashApi send message to your channel is channels:read, channels:write, and channels:write.public permissions. You can add another permission to allow your bot send a message with a customized username and avatar by adding chat:write.customize permission.
Install the App to Workspace and click Allow
After installation you will get the OAuth token and use this token on SlashApi creation form.
Send notification to Slack channel
Parameter | Description |
---|---|
from | The name to send the message from. |
channel | The channel to send the message on. |
text | The text content of the message. |
icon | [optional] The user image or emoji icon for the message. |
level | [optional] The "level" of the notification (info, success, warning, error). |
attachment | [optional] The message's attachments. |
{
"from":"Your App",
"channel": "#general",
"text": "This will be sent to #general.",
"icon": ":ghost:"
}
{
"from":"Your App",
"channel": "#general",
"text": "Whoops! Something went wrong.",
"icon": ":ghost:",
"level": "error",
"attachment": {
"title": "Exception: File Not Found",
"url": "https://slashapi.com",
"text": "File [background.jpg] was not found."
}
}
{
"from":"Your App",
"channel": "#general",
"text": "One of your invoices has been paid!",
"icon": ":ghost:",
"level": "success",
"attachment": {
"title": "Invoice 1322",
"url": "https://slashapi.com",
"text": "This is a confirmation that we have just received your secure online payment",
"fields": {
"Title": "Personal Subscription",
"Amount": "$10",
"Via": "American Express",
"Was Overdue": ":-1:"
}
}
}