Module slack

ballerinax/slack Ballerina library

4.0.0

Overview

Slack is a collaboration platform for teams, offering real-time messaging, file sharing, and integrations with various tools. It helps streamline communication and enhance productivity through organized channels and direct messaging.

Setup guide

Step 1: Sign in to Slack

  1. To use the Slack Connector you need to be signed in to Slack. If you haven't created an account already, you can create it here.

    Sign-In Page

Step 2: Create a new Slack application

  1. Navigate to your apps in Slack API and create a new Slack app.

    Create Slack App
  2. Provide an app name and choose a workspace of your choice.

    Create Slack App Popup
  3. Click on the "Create App" button.

Step 3: Add scopes to the token

  1. Once the application is created, go to the "Add Features and Functionality" section and click on "Permissions" to set the token scopes.

    Add features and functionality
  2. In the User Token Scopes section set the following token scopes.

    User Token Scopes
  3. Install the application to workspace.

    Install to workspace
  4. Copy the OAuth token that is generated upon installation.

    Copy token

Quickstart

To use the slack connector in your Ballerina application, modify the .bal file as follows:

Step 1: Import the module

Import the slack module.

Copy
import ballerinax/slack;

Step 2: Instantiate a new connector

Assign the OAuth token obtained to the variable token, and then initialize a new instance of the slack client by passing the token.

Copy
configurable string token = ?;

slack:Client slack = check new({
    auth: {
        token
    }
});

Step 3: Invoke the connector operation

Now, utilize the available connector operations.

Send a Text Message to General Channel

Copy
slack:ChatPostMessageResponse postMessageResponse = check slack->/chat\.postMessage.post({channel: "general", text: "hello"});

Step 4: Run the Ballerina application

Copy
bal run

Examples

The Slack connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:

  1. Automated Summary Report - This use case demonstrates how the Slack API can be utilized to generate a summarized report of daily stand up chats in the general channel.

  2. Survey Feedback Analysis - This use case demonstrates how the Slack API can be utilized to perform a company-wide survey by creating a dedicated channel to receive and track feedback replies.

Import

import ballerinax/slack;Copy

Metadata

Released date: 3 months ago

Version: 4.0.0

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.9.3

GraalVM compatible: Yes


Pull count

Total: 6311

Current verison: 17


Weekly downloads


Source repository


Keywords

Communication/Team Chat

Cost/Freemium


Contributors

Other versions

See more...