Head to the Quickstart guide to use our automated installer script, or download the latest version of the Slack CLI and follow instructions to install it manually.
Developing automations requires a paid plan. Don't have a paid plan? Join the Developer Program and provision a sandbox with access to all Slack features for free.
Have more questions? Check out our developer sandbox FAQs!
If you have installed the Slack CLI previously and have an older version, note that the minimum required Slack CLI version for Enterprise Grid as of September 19th, 2023 is v2.9.0
. If you attempt to log in with an older version, you'll receive a cli_update_required
error from the Slack API. Run slack upgrade
to get the latest version.
Using a combination of your favorite text editor, the Slack CLI, and the included Deno Slack SDK, you'll develop using TypeScript with a Deno runtime environment.
The automation platform is closely tied to specific language runtimes and SDKs. As you install and utilize your developer tools, you should expect requests from your network to the following non-exhaustive list of hosts:
api.slack.com
, configuration information and documentation resourcesdownloads.slack-edge.com
, where binaries and other static resources are hosted by Slackslack.com
, where most of the individual APIs reside called by the Slack CLI and your appslackb.com
, general logging for your triggers, functions, and workflowsslackd.com
, where we send information about errors, warnings, and other special conditionsdeno.land
, where the Typescript runtime, Deno, resolves & retrieves dependencies and versionsFor more information, refer to team collaboration.
Workflows can be started manually by users via link triggers. There are multiple ways to invoke a link trigger, and one of them is with a /
keystroke via the Shortcut menu.
In other words, you can use a slash command to invoke a link trigger that will kick off a workflow.
At this time, apps deployed to Slack's managed infrastructure are built with Typescript in a Deno runtime environment.
When you use slack run
, the local development version of your app connects to Slack via socket mode directly from where you're developing. As you use Slack (or other tools) to interact with your app's triggers, workflows, and functions, data is sent back and forth against your latest saved code. Use this while you're still tweaking things. Your development app is generally only shared with other collaborators, though you can test the full range of trigger options anyway.
When you use slack deploy
, the fine computer instructions you've written are packaged up and deployed to Slack. As users interact with your app, data is swiftly and securely sent back and forth between Slack servers. Treat this instance of your app with care, especially as your userbase grows.
The local and deployed environments have different triggers associated with them. Triggers you create in a local context will not automatically be created in a deployed context when you deploy your app.
Currently, automations apps are not eligible for listing in the App Directory.
An example of how to do this is shown in the GitHub Issue tutorial, but the long and short of it is this:
.env
file could look like this.github_name = slackbotsbestpal
github_token = ABC123DEF
env
context property to call environment variables from within your function.import { DefineFunction, Schema, SlackFunction } from "deno-slack-sdk/mod.ts";
export const MyFunctionDefinition = DefineFunction({
callback_id: "my_function",
title: "my function",
source_file: "functions/my_function.ts",
input_parameters: { properties: {}, required: [] },
output_parameters: { properties: {}, required: [] },
});
export default SlackFunction(
MyFunctionDefinition,
async ({ inputs, env }) => { // Add this
const headers = {
Authorization: `Bearer ${env.GITHUB_TOKEN}`,
"Content-Type": "application/json",
};
try {
const endpoint = "https://api.github.com/users/repos";
const response = await fetch(endpoint, { method: "GET", headers });
if (response.status != 200) {
// In the case where the API responded with non 200 status
const body = await response.text();
const error =
`Failed to call an API (status: ${response.status}, body: ${body})`;
return { error };
}
// Do cool stuff with your repo info here
const repos = await response.json();
return { outputs: {} };
} catch (err) {
const error = `Failed to call GitHub API due to ${err}`;
return { error };
}
},
);
That's all! When you run your app, it will use the environment variables stored within your .env
file. You won't be using your .env
file when your app is deployed (nor should you ever commit that file to source control), so the real power of environment variables is seen when you use the env
Slack CLI helper. Once your app is deployed using slack deploy
, add your environment variable with the following command:
slack env add github_token ABC123DEF
If your token contains non-alphanumeric characters, wrap it in double quotes.
Environment variables added via the slack env add
command can be accessed via the env
Slack CLI helper, which also allows you to update
and remove
them.
Yes, you can! To use a Deno Third Party Module, Deno imports modules using URLs. You can see how we do this for a test file in the Deno GitHub functions sample app.
// /functions/create_issue_test.ts
import * as mf from "https://deno.land/x/mock_fetch@0.3.0/mod.ts";
The Slack CLI is commonly used in local development (usually in an interactive mode with prompts), but can also be used for automating testing and deployments (done without interactivity by using flags) by way of a Continuous Integration and Continuous Delivery (CI/CD) pipeline.
Running this type of automation requires authorization with a service token. Refer to CI/CD authorization for more details. You'll also need to accomodate requests from your network to a variety of hosts. Refer to Which hosts are involved in the creation and execution of apps created with the Slack CLI? for more details.
Bolt is not part of the automation platform. Follow the Quickstart guide to get up and running with the Slack CLI and our Deno Slack SDK to build and deploy automations for your workspace and beyond.
Even some Slack developers are themselves Slack administrators, but if you're an admin you might find yourself here wondering these very same questions. If you don't find the answer to your administrative questions here, do consult the Slack help center for more user and admin-facing content.
The new custom functions and workflows introduced to the Slack platform cannot be completely disabled. Instead, you can manage their installation via the app approvals feature.
From the published workflow dashboard, you can view a list of workflows in your workspace or Enterprise Grid organization. You’ll also see a banner at the top of the dashboard page showing how much of your premium workflow allotment has been used.
For the most up to date information about pricing, please consult this help center page on pricing.
These changes to our platform are designed to simplify and streamline development through new capabilities, like reusing custom functions and running your app on our managed infrastructure. To reflect that added value, the automation platform has a paid component.
Whether a workflow is standard or premium depends on the type of functions it includes, and usage is determined by how many times a workflow is run. Paid Slack plans include standard workflow runs and an allotment of premium workflow runs.
Note: Premium workflows are chargeable. If you exceed your allotment of premium workflow runs, pricing is based on how many times you run a premium workflow.
Beginning November 1st 2023, you’ll be charged for any premium workflow runs that exceed your plan’s allotment. If you don’t exceed your allotment, you won’t be charged.
Currently, workflows are considered standard if they use Slack functions and premium if they include at least one custom function. Right now, developers and customers in our Workflow Builder pilot program can build workflows using custom functions.
If you’re a Workspace Primary Owner or admin with permissions, you can also go to your Billing page to see how many premium workflow runs included in your plan’s allotment have been used. Questions? Let our Support team know, or reach out to your account executive.
Your existing apps will continue working as expected. Some older Slack apps might even produce activity in Slack you can build custom functions and workflows around. That said, automations are meant to co-exist with the rest of our platform and your existing integrations and customizations.
The slack deploy
command performs two operations:
slack deploy
, the workflows that belong to that app are also “installed” (made available) in that workspace. Currently, there is no way for a coded workflow to be "installed" (via the parent app being installed) by anyone other than the developer. However, coded workflows do not have to be deployed alongside a trigger; since triggers don't belong to apps, all deployment and installation happens first and then a trigger is created separately afterward.manifest.ts
.Have 2 minutes to provide some feedback?
We'd love to hear about your experience building Slack automations. Please complete our short survey so we can use your feedback to improve.