Algorithmia Blog - Deploying AI at scale

How to integrate Machine Learning into your Slack channels

Slack is one of the fastest growing companies of all time, and there’s a good chance it’s also the messaging app that you use for work. The Algorithmia Slack Client lets you integrate Machine Learning into your Slack channels – both as slack commands and as bot users – giving you more firepower on top of the already vibrant ecosystem of third party Slack integrations.

Integrating Machine Learning into your Slack

Here are some ways to integrate Machine Learning into Slack with Algorithmia as the backend:

1. Summarize and extract keywords from text

There’s more content around these days than ever, and it can be hard to cut through the noise. Summarizing blocks of text and extracting the proper tags is an effective application of Machine Learning that can save you time and effort:

Using our Slack Client, you’d just pass the algorithm name (Summarizer) and the content you want tagged or summarized, and Algorithmia will send you back the results.

2. Analyze sentiment of tweets about your brand

One of the simplest but most powerful applications of Machine Learning is to monitor and understand what your customers are saying about you on public channels. Using sentiment analysis, you can fetch recent tweets about your brand and see how public sentiment stacks up.

In Slack, you can run a retrieve tweets algorithm and then use that output as an input to Social Sentiment Analysis.

3. Colorize and apply image filters

Image filters are some of our most popular demos: people love adding a splash of color and excitement to their photos:

  • Colorizer adds color to black and white photos
  • DeepFilter lets you apply artistic and complex filters to images

To colorize or filter images through Slack, you’d pass the algorithm name and then the url of the image you’re targeting.

4. Upload and run a custom model

Algorithmia’s AI Layer makes it as easy as git push to upload your pretrained models and scale them automatically. If you’ve got an algorithm that you want to call from Slack, you can publish it on Algorithmia and call it just like any of the above use cases.

Using the Algorithmia Slack Client

There are two ways to integrate Algorithmia into Slack: as a slash command and as a bot user. Both require setting up a simple server that can accept and handle requests from a user. We’ll show you how to set up the client using slash commands (/command arguments).

You’ll need to start with Slack’s guide to create a Slack App, and read up on how Slash Commands work. Then head to your Slack App Management Page and click on the App name to see the details of our Slack App. Under “Basic Information”, copy the “Verification Token” – you’ll need it for the code below.

In order for your Slack App to connect to Algorithmia, you’ll need an intermediate function: and API endpoint which can accept a GET request from Slack, validate the content, and then POST to one of Algorithmia’s APIs. We’ll use a simple NodeJS setup which can run as a Google Cloud Function, or be easily ported into your own NodeJS server:

That’s it! For more details, check out our guide to getting up and running with Algorithmia in Slack. Don’t hesitate to reach out to us through Intercom with any questions and suggestions.