Noteworthy Updates to the Slack Node SDK

A modern take on the Slack Platform in Node.js

Ankur Oberoi
Slack Platform Blog
3 min readMar 8, 2018

--

Art by Pete Ryan

Good news: version 4.0 of the Slack Node SDK is now available. You can install the package from npm today (@slack/client), which includes TypeScript definitions, more usable APIs, and performance improvements. If you’ve built a Slack app using older SDK releases, read our migration guide to update to the newest version.

This update goes beyond the evolutionary steps we’ve delivered in previous Node SDK versions, and debuts some highly requested features. Let’s jump straight into the highlights.

Delightful development with typed interfaces

Thanks to its active community and broad set of tooling, JavaScript is a favorite language for many developers. As programs get bigger and more complex, the JavaScript community collectively builds tools that help this language feel more productive and reliable. Tools like Intellisense reflect on the types of functions and the shape of data in a program.

In version 4, we’re making that information clear by maintaining our SDK source code in TypeScript.

Writing JavaScript with autocompletion in VS Code

Declaring the SDK interfaces with explicit types opens the door for smarter code completion, saving you development time. The best part is you won’t need to do anything differently: many modern code editors (like Atom, VS Code, and WebStorm) light up with these hints. Depending on your editor of choice, you can use this information for linting, interactive error highlighting, or refactoring across files. Even classic editors like vim and emacs have plugins that take advantage of the declarative types.

Building with intuition

In this update, you should find yourself making fewer round trips to our documentation because we’re ditching positional arguments in favor a plain object dictionary to contain them.

Each of the Slack platform’s Web API methods have a set a required and optional arguments. In previous versions of the SDK, you had to know which arguments were required, and in which order. Now, you supply the arguments in a key-value object, so the order doesn’t matter.

Stop worrying about the order of arguments

Gone are the days of receiving indecipherable error, only to find out you’d accidentally misunderstood the order of the arguments.

Predictably paced updates

Many enterprise companies require predictable release cycles with established support timelines. When the Node.js Foundation published the Long-Term Support (LTS) schedule, it enabled many large companies to depend on the technology for business-critical projects. Building off of that success, we’re introducing a support schedule for the Node Slack SDK so you can plan more effectively.

TL;DR: Once a year, when the Node.js LTS schedule specifies that a version is being retired, we may also drop support for a major version of the Slack Node SDK. Once announced, you’ll have at least 90 days to decide on your migration strategy. Visit our wiki for more detail on the Node SDK support schedule.

Migrating from previous versions

We’ve compiled a migration guide that walks you through each of the API changes that could impact your code if you’re coming from a previous version.

The most notable change, as we announced in v3.15.0, is that DataStore will not be coming along for the ride. As the Slack Platform has evolved to include Slack Enterprise Grid and Shared Channels, many of DataStore’s core design assumptions didn’t hold. If your app uses DataStore, this guide provides instructions for moving away from it.

Install the packagenpm install @slack/client@4 to try the latest, or visit our GitHub repo to learn more. Thought or requests? Send us a note at devsupport@slack.com.

--

--

Ankur Oberoi
Slack Platform Blog

developer advocate @SlackHQ, formerly @TokBox. javascript web, iOS, android developer. enjoy philosophy, design, hci, and funny people.