Modal Title
Software Development / Software Testing

5 Tips to Build Like a Pro with Slack’s Deno SDK and New CLI

Top tips to help you get the most out of the new capabilities when building on the Slack platform
Jun 9th, 2023 9:33am by
Featued image for: 5 Tips to Build Like a Pro with Slack’s Deno SDK and New CLI

With the recent launch of Slack’s next generation platform, we’ve released two new purpose-built developer tools that make building projects on the Slack platform a breeze. First, we released the new Slack CLI, which makes it incredibly easy to create, update and deploy projects right from the terminal. Next, we released the Deno Slack SDK, which is written in TypeScript and is open sourced and focused on helping developers build new modular apps quickly and securely.

How Do I Harness These New Capabilities?

Slack chose Deno, a relatively new JavaScript runtime, to power its new platform. This is because Deno is compliant with web standards, has a simpler dependency management system, and is secure by default, giving admins peace of mind and developers built-in granular controls, like the ability to execute code with limited access to the file system or external domains.

Deno also has support for TypeScript out of the box, which is our language of choice for developing new modular apps with the Deno Slack SDK. I’m especially a fan of the way Deno standardizes the way modules are imported in both JavaScript and TypeScript using the ECMAScript 6 import/export standard.

Throughout our open beta, we have been gathering feedback from developers using our new tools. These are my top tips to help you get the most out of our tools capabilities when building on the Slack platform:

Tip 1: Use Type Hints

Type hints will save you both time and frustration, so take advantage of the IntelliSense features of your code editor. Because the Deno Slack SDK is written in Typescript, you are provided with advanced type hints that make it easy to learn about what methods, arguments and types are available for projects you are building.

Tip 2: Develop Rapidly in Local Mode

Minimize risk and errors by rapidly iterating on your projects in local mode with the Slack CLI. Local mode (or “slack run”) gives you a way to quickly iterate on your projects and see the changes reflected in your workspace. This is a great way to get your projects functional before deploying them on Slack’s infrastructure.

Tip 3: Unit Test Your Functions

Use our built-in SlackFunctionTester utility to help write unit tests for your custom functions. SlackFunctionTester allows you to easily specify the inputs and verify the outputs of a custom function. Once you have written your unit tests, you can use Deno’s built-in test runner to run your tests. Read our docs to learn more about testing.

Tip 4: Take Advantage of Built-in Slack Functions

Slack now offers built-in Slack functions that allow you to do common tasks without having to write custom-coded functions or directly call the Slack API, saving you valuable time. Some examples of Slack functions include opening a form to gather data, creating and archiving channels, updating channel topics and sending messages in Slack. These can be used as steps in your coded workflows and will also be available in the upcoming revamped Workflow Builder.

Tip 5: Harness Sample Apps and Templates

Don’t know where to start? We’ve created many sample apps that are just waiting for you to tweak and make them your own. You can access them in the Slack CLI when running slack create or slack samples to see the entire list, or view them on our docs.

What’s the Future of the Deno Slack SDK and the Slack CLI?

With both the Slack CLI and the Deno Slack SDK, we are continuing to put our foot on the pedal to incorporate feedback and continue improving the developer experience. The Slack CLI will also look at improving its support for CI/CD and how easy it is to script common tasks.

My team is also looking into open sourcing our CLI on GitHub and can’t wait to share the code. With the Deno Slack SDK, we’re focusing on making it even easier to use functions and connectors created by other developers in your coded workflows. And with Deno 2.0 expected to be released this summer, we got a lot to look forward to. Come let us know your experience with the Deno Slack SDK on GitHub.

Slack aims to make work more efficient and productive for all, and creative devs like you are powering that effort. So test out our new platform, start building cool stuff, and let us know what you think!

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Pragma, Unit, Deno.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.