Interact with Slack

Use these recipes to create a channel for communication on the Slack application and post a message to a specific Slack channel, respectively.

Note:

These recipes are available in the Integration Store as:
  • REST — Slack | Create Channel
  • REST — Slack | Post Message

Oracle provides these recipes as samples only. These recipes are meant only for guidance, and are not warranted to be error-free. No support is provided for these recipes.

Overview

Using the Slack recipes, you can:
  • Create a public or private channel for communication on the Slack application.
  • Post a message to a public or private Slack channel.
To run the Slack recipes, you must configure the Oracle Slack Connection with the details necessary to access the Slack application. You can then trigger the recipes through a REST request and supply the necessary request payload.
  • For the REST — Slack | Create Channel recipe, you must supply the name and type for the new channel you want to create as the payload. The Slack Adapter in the recipe is subsequently invoked, and it creates the channel as specified in your Slack workspace. The response containing the channel-creation details is returned to you.
  • For the REST — Slack | Post Message recipe, you must supply the massage you want to post and the name of the channel you want to post the message in as payload. The Slack Adapter in the recipe is subsequently invoked, and it posts the message in the specified Slack channel. The response containing the message-post details is returned to you.
Integration Name Description REST Commands and Example Payloads

Create Channel

Creates a public or private channel for communication on the Slack application.

REST API Command:
POST: https://<host:port>/ic/api/integration/v1/flows/rest/ORCL-R-SLACK_CREATE_CHANNEL/1.0/createChannel
Example Request Payload:
  {
"channelName": "New-Channel",
"is-private":"true"
}
Example Response Payload:
{
    "ok": "true",
    "channel": {
        "id": "C01SGRKT84E",
        "name": "New-Channel",
        "is_channel": "true",
        "is_group": "false",
        "is_im": "false",
        "created": "1617017971",
        "is_archived": "false",
        "is_general": "false",
        "unlinked": "0",
        "name_normalized": "new-channel",
        "is_shared": "false",
        "creator": "U01PUKGN6SK",
        "is_ext_shared": "false",
        "is_org_shared": "false",
        "is_pending_ext_shared": "false",
        "is_member": "true",
        "is_private": "true",
        "is_mpim": "false",
        "last_read": "0000000000.000000"
    }
}

Push Notification

Posts a message to a public or private Slack channel.

REST API Command:
POST: https://<host:port>/ic/api/integration/v1/flows/rest/ORCL_R_SLACK_PUSH_NOTIFICA/1.0/postMessage
Example Request Payload:
{
"Message": "Test Message",
"channelName": "new-channel"
}
Example Response Payload:
{
    "ok": "true",
    "channel": "C01SGRKT84E",
    "ts": "1617031570.000300",
    "message": {
        "bot_id": "B01SC4EJ4JU",
        "type": "message",
        "text": "Test Message",
        "user": "",
        "ts": "1617031570.000300",
        "team": ""
    }
}

System and Access Requirements

  • Oracle Integration
  • Slack

Install, Configure, and Run the Recipes

For more information and steps to install, configure, and run recipes, see Get Started with Integration Accelerators and Recipes.

Configure the Oracle REST Trigger Connection and the Oracle Slack Connection present in the recipe package. You only need to configure these connections once. Both the Slack recipes mentioned in this topic use the same connections.

You must supply the following information when you configure these connections.

Connection Name Parameters

Oracle REST Trigger Connection

The connection parameters are already configured for you. Test and save the connection.

Oracle Slack Connection

Security

  • Client ID: The Client ID of the OAuth application created on Slack.
  • Client Secret: The Client Secret of the OAuth application created on Slack.
  • Scope: The list of user token scopes for which you want to grant permission.

For more details, see Create a Slack Adapter Connection in Using the Slack Adapter with Oracle Integration.