Slack Bot APIs offer powerful and flexible ways to automate repetitive tasks and integrate workflows from various services. With the help of these APIs, it is possible to develop Slack bots capable of exiting and entering specific channels as well as performing various actions requested from users.
A Slack bot can be used to automate specific tasks and carry out routine admin jobs such as checking the team’s working time, organizing team meetings, managing customer inquiries and so on. These bots can be programmed to inform the members of the team when tasks are completed. Some of the examples of what you can create using the Slack Bot APIs are:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
slack_bot: {
type: "app",
app: "slack_bot",
},
},
async run({steps, $}) {
return await axios($, {
url: `https://slack.com/api/auth.test`,
headers: {
Authorization: `Bearer ${this.slack_bot.$auth.bot_token}`,
},
method: 'post',
})
},
})
Emit new event when a message is posted in a direct message channel (Bot). To open a conversation, use the Pipedream Action "Send a Direct Message" to send a message from the Bot, or enable direct messages to the Bot in your App Settings (Settings->App Home->Show Tabs->Messages Tab), and send a direct message to the Bot.
Emit new event when a new message is posted to a public, private or group channel (Bot)
Slack Bot uses API keys for authentication. When you connect your Slack Bot account, Pipedream securely stores the keys so you can easily authenticate to Slack Bot APIs in both code and no-code steps.
In the settings for your Slack app, visit the OAuth & Permissions section on the left. You'll see a token labeled Bot User OAuth Access Token. Copy and paste that below.
See Slack's docs on Bot User Tokens for more info.