Socket to me

Build custom Slack integrations on-premise with Socket Mode

Jim Ray
Jim Ray
Jan 12 · 3 min read
Image for post
Image for post
Illustration and design by Casey Labatt-Simon.

Socket Mode enables you to build powerful Slack integrations safely behind your company’s firewall and unlocks access to the platform’s most interactive features — from the Events API to Block Kit to Workflow Builder.

Today, millions of daily active users get exponential value from bringing their work into Slack. For developers, this means as Slack grows, you grow with us — sharing in our goal to improve the way teams collaborate through business-critical integrations.

Socket Mode solves

Socket Mode enables a quick and secure way to start building apps without additional infrastructure management.

Previously, anyone could use the Slack platform to build apps based on the standards and protocols of the open web, using HTTP to send and receive messages and other data. This didn’t require any special tooling or software — fundamentally, a Slack app is a web app.

However, for anyone hosting their apps on-premise or behind a firewall, this presented a challenge for integrating with Slack — specifically when routing Slack API data to apps in a restricted environment.

Some customers built proxies to safely transfer packets from the internet to their network. Others created WebSocket connections using the RTM API, but the RTM stream primarily contains message data and doesn’t support many of the richer interactive features of the platform like events, Block Kit, or shortcuts.

For software engineer at Dell Technologies, Bob Bell, using Socket Mode means not having to manage additional layers of software.

“This let us replace a layer seven proxy, which required coordination to set up,” Bell said. “With Socket Mode, we can just immediately start writing a Slack app.”

Develop locally, deploy anywhere

Any app, new or existing, can connect over Socket Mode. The logic stays the same, and the payloads remain identical — regardless of delivery method.

We often recommend tooling like ngrok to manage local development. Now you can enable Socket Mode, connect from your local machine, build out the logic of your app, then deploy to a web server and switch back to HTTP.

Image for post
Image for post
Enable Socket Mode through the settings section of your app’s configuration page.

Apps can choose the delivery protocol, WebSocket or HTTP. It’s a binary switch that gets flipped for your app — which can happen at any point and flip back if necessary. Your app simply needs to be able to handle either HTTP or WebSockets.

With Socket Mode enabled, an app connects to Slack by establishing a secure WebSocket connection. From here, all dispatches from Slack are sent to your app over this WebSocket and nothing is sent via HTTP.

Build better with Bolt

After enabling Socket Mode, all that’s required for your app is a WebSocket connection. There are no new proprietary protocols or custom SDKs required — industry standards all the way.

Socket Mode support is available in JavaScript, Java, and Python through our SDKs and Bolt, a Slack-first framework for building apps. Using Bolt, new and existing apps can enable Socket Mode by simply adding a few new lines of code.

If you’re building an app without an SDK, fear not! Here’s a quick implementation guide to help you along the way.

Getting started

To build with Socket Mode, visit our API documentation for an introduction to some core concepts, the new app token, and related sample code.

Need more hands-on support? Join our webinar later this month. Sign up to save your spot today.

We look forward to whole new class of Slack apps hosted everywhere. Happy building!

We value your questions and feedback. Email us at feedback@slack.com.

Slack Platform Blog

Several bots are typing…

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store