SlackBolt
A JavaScript framework to build Slack apps in a flash with the latest platform features

Official Websitehttps://slack.dev/bolt-js/
Documentationhttps://slack.dev/bolt-js/tutorial/getting-started
NodeJS packagehttps://www.npmjs.com/package/@slack/bolt
Version3.11.0
Source Codehttps://github.com/slackapi/bolt-js
Tagsslack, bolt
SlackBolt snippets available in editor
note
The title is the triggering text for YepCode to autocomplete the script.
Excluding the Web Api, the rest of the slack bolt features have no place in yepcode due its nature.
Integration
New integration from credential
const app = await yepcode.integration.slackBolt("credential-slug")
New integration from plain authentication data
const { App } = require("@slack/bolt")
const app = new App({
token: "my-token"
signingSecret: "my-signing-secret"
})
Using the Web API
Lists channels
const listChannels = async () => {
try {
const { channels } = await app.client.conversations.list();
console.log(result);
} catch (error) {
console.error(error);
}
};
listChannels();
Retrieve messages
const retrieveChannelMessages = async () => {
try {
const result = await app.client.conversations.history({
channel: "channel",
});
const { messages } = result.messages;
console.log(messages);
} catch (error) {
console.error(error);
}
};
retrieveChannelMessages();
Post a message
const postMessage = async () => {
try {
const result = await app.client.chat.postMessage({
channel: "channel",
text: "He who controls the Spice, controls the universe!",
});
console.log(result);
} catch (error) {
console.error(error);
}
};
postMessage();
Upload a file
const { createReadStream } = require("fs");
const uploadAFile = async () => {
try {
const result = await app.client.files.upload({
channels: "channel",
initial_comment: "Here's my file :smile:",
file: createReadStream("fileName"),
});
console.log(result);
} catch (error) {
console.error(error);
}
};
uploadAFile();