ByteChef LogoByteChef

Slack

Slack is a messaging platform for teams to communicate and collaborate.

Categories: Communication, Developer Tools

Type: slack/v1


Connections

Version: 1

OAuth2 Authorization Code

Properties

NameLabelTypeDescriptionRequired
clientIdClient IdSTRINGtrue
clientSecretClient SecretSTRINGtrue

Connection Setup

Create OAuth 2.0 App

  1. Navigate to Slack App.
  2. Click on Create New App.
  3. Click on From scratch.
  4. Enter name of your app and select workspace where it will be installed.
  5. Click on Create App.
  6. Click on Basic Information
  7. Click on OAuth & Permissions.
  8. Click on Add New Redirect URL. ByteChef redirect URL: https://127.0.0.1:5173/callback or https://app.bytechef.io/callback.
  9. Click on Add.
  10. Click on Save URLs.
  11. Click on Add an OAuth Scope.
    • channels:read
    • channels:write
    • channels:history
    • chat:write:bot
    • groups:read
    • reactions:read
    • mpim:read
    • users:read
    • incoming-webhook
  12. Under OAuth tokens click on Install to ....

Actions

Add Reaction

Name: addReaction

Adds a reaction to a message.

Properties

NameLabelTypeDescriptionRequired
channelChannel IDSTRINGID of the channel, private group, or IM channel where the message is located.true
nameEmoji NameSTRINGReaction (emoji) name to add.true
timestampTimestampSTRINGTimestamp of the message to add reaction to.true

Example JSON Structure

{
  "label" : "Add Reaction",
  "name" : "addReaction",
  "parameters" : {
    "channel" : "",
    "name" : "",
    "timestamp" : ""
  },
  "type" : "slack/v1/addReaction"
}

Output

Type: OBJECT

Properties

NameTypeDescription
okBOOLEAN
Options true, false
Indicates if the reaction was successfully added.
warningSTRING
responseMetadataOBJECT
Properties {[STRING](messages)}

Output Example

{
  "ok" : false,
  "warning" : "",
  "responseMetadata" : {
    "messages" : [ "" ]
  }
}

Find Channel ID and Timestamp

To find the Channel ID, click here

To find the Timestamp, click here

Send Approval Message

Name: sendApprovalMessage

Sends approval message to a channel.

Properties

NameLabelTypeDescriptionRequired
channelChannelSTRINGChannel, private group, or IM channel to send message to.true
textMessageSTRINGThe text of your message.true

Example JSON Structure

{
  "label" : "Send Approval Message",
  "name" : "sendApprovalMessage",
  "parameters" : {
    "channel" : "",
    "text" : ""
  },
  "type" : "slack/v1/sendApprovalMessage"
}

Output

Type: OBJECT

Properties

NameTypeDescription
okBOOLEAN
Options true, false
Indicates if the message was successfully sent.
channelSTRINGID of the channel the message was sent to.
tsSTRINGTimestamp of the message.
messageOBJECT
Properties {STRING(user), STRING(type), STRING(ts), STRING(text), STRING(team), STRING(subtype)}
The sent message.
warningSTRING
responseMetadataOBJECT
Properties {[STRING](messages)}

Output Example

{
  "ok" : false,
  "channel" : "",
  "ts" : "",
  "message" : {
    "user" : "",
    "type" : "",
    "ts" : "",
    "text" : "",
    "team" : "",
    "subtype" : ""
  },
  "warning" : "",
  "responseMetadata" : {
    "messages" : [ "" ]
  }
}

Find Channel ID

To find the Channel ID, click here

Send Channel Message

Name: sendChannelMessage

Sends a message to a public or private channel.

Properties

NameLabelTypeDescriptionRequired
channelChannel IDSTRINGID of the channel, private group, or IM channel to send message to.true
post_atPost atDATE_TIMEDate and time when the message should be sent.false
textMessageSTRINGThe text of your message.true

Example JSON Structure

{
  "label" : "Send Channel Message",
  "name" : "sendChannelMessage",
  "parameters" : {
    "channel" : "",
    "post_at" : "2021-01-01T00:00:00",
    "text" : ""
  },
  "type" : "slack/v1/sendChannelMessage"
}

Output

Type: OBJECT

Properties

NameTypeDescription
okBOOLEAN
Options true, false
Indicates if the message was successfully sent.
channelSTRINGID of the channel the message was sent to.
tsSTRINGTimestamp of the message.
messageOBJECT
Properties {STRING(user), STRING(type), STRING(ts), STRING(text), STRING(team), STRING(subtype)}
The sent message.
warningSTRING
responseMetadataOBJECT
Properties {[STRING](messages)}

Output Example

{
  "ok" : false,
  "channel" : "",
  "ts" : "",
  "message" : {
    "user" : "",
    "type" : "",
    "ts" : "",
    "text" : "",
    "team" : "",
    "subtype" : ""
  },
  "warning" : "",
  "responseMetadata" : {
    "messages" : [ "" ]
  }
}

Find Channel ID

To find the Channel ID, click here

Send Direct Message

Name: sendDirectMessage

Sends a direct message to another user in a workspace. If it hasn't already, a direct message conversation will be created.

Properties

NameLabelTypeDescriptionRequired
channelUser IDSTRINGID of the user to send the direct message to.true
post_atPost atDATE_TIMEDate and time when the message should be sent.false
textMessageSTRINGThe text of your message.true

Example JSON Structure

{
  "label" : "Send Direct Message",
  "name" : "sendDirectMessage",
  "parameters" : {
    "channel" : "",
    "post_at" : "2021-01-01T00:00:00",
    "text" : ""
  },
  "type" : "slack/v1/sendDirectMessage"
}

Output

Type: OBJECT

Properties

NameTypeDescription
okBOOLEAN
Options true, false
Indicates if the message was successfully sent.
channelSTRINGID of the channel the message was sent to.
tsSTRINGTimestamp of the message.
messageOBJECT
Properties {STRING(user), STRING(type), STRING(ts), STRING(text), STRING(team), STRING(subtype)}
The sent message.
warningSTRING
responseMetadataOBJECT
Properties {[STRING](messages)}

Output Example

{
  "ok" : false,
  "channel" : "",
  "ts" : "",
  "message" : {
    "user" : "",
    "type" : "",
    "ts" : "",
    "text" : "",
    "team" : "",
    "subtype" : ""
  },
  "warning" : "",
  "responseMetadata" : {
    "messages" : [ "" ]
  }
}

Find Channel ID

To find the Channel ID, click here

Triggers

Any Event

Name: anyEvent

Triggers when any user subscribed event happens.

Type: STATIC_WEBHOOK

Output

The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.

JSON Example

{
  "label" : "Any Event",
  "name" : "anyEvent",
  "type" : "slack/v1/anyEvent"
}

How to set up trigger

To find out how to set up trigger, click here.

What to do if your action is not listed here?

If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.

To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.


Additional Instructions

How to find the Channel ID

Open Slack and then channel (or person you want to send direct message to) you want fo find ID of. When you click on channel name you will see Channel details, and in About tab the lowest written value is the Channel ID.

How to find the Timestamp

There is no other way to find the timestamp of a message than to use Slack API. So the best way to find timestamp is to use output of one of Bytechef's Slack actions. In the output of the Slack actions you will find ts property, that is timestamp that you need.

Trigger Setup

Enable Event Subscription

  1. Create workflow with Slack trigger.
  2. Publish the workflow.
  3. Click on Publish.
  4. Go to Project Deployments.
  5. Click on Create Deployment.
  6. Select Slack Project.
  7. Select Version.
  8. Click on Next.
  9. Enable workflow.
  10. Select Connection.
  11. Click on Save.
  12. Enable deployment.
  13. Click on here to expand deployment.
  14. Click this icon to get webhook URL.
  15. Navigate to link and select your app.
  16. Click on Event Subscriptions.
  17. Enable Events.
  18. Click on Enable.
  19. Click on Change.
  20. Enter copied webhook URL to verify it.
  21. Click on Subscribe to bot events.
  22. Click on Add Bot User Event.
  23. You can select any event you want to trigger your workflow.
  24. Click on Save Changes.

How is this guide?

Last updated on

On this page