Slack

Send notification to slack using REST API without any code.

Overview

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.

Getting Started

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.

Getting OAuth Token

  1. 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.

  2. Configure your app's scopes and settings from scratch

  3. Then, you need to fill in a form and choose a workspace you want to add your app to. Choose Workspace

  4. 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.

    Configure Permissions

    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.

    Configure Scopes

  5. Install the App to Workspace and click Allow

    Install app

  6. After installation you will get the OAuth token and use this token on SlashApi creation form.

    Slack Token

API Endpoints

Send Notification

Send notification to Slack channel

POST
<team>/slack/<identifier>

Request Body

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.

Example Request

Basic Notification
{
    "from":"Your App",
    "channel": "#general",
    "text": "This will be sent to #general.",
    "icon": ":ghost:"
}
Error Level Attachment
{
    "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."
    }
}
Success Level Attachment
{
    "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:"
        }
    }
}