Slack Bot That Summarizes Articles
At Midio, like most companies, we constantly share links to articles in various Slack channels. However, we don't have an established routine of including a summary of the posts we share. We decided to create a Slack bot in Midio to automate this for us!
In this guide, you will learn how to build a Slack bot that summarizes an article and posts it as a reply in the relevant thread.
Demo
Prerequisites
Midio account (you can create one here)
Slack account and workspace
API key for Tavily. This is the API used to extract content from links. You can get a free key for up to 1,000 API credits / month
Setting up the Slack bot
Go to api.slack.com/apps and click Create New App
Select From manifest and paste in this manifest:
Take notice of request_url in event_subscriptions. After creating a Midio project, you have to change its value to <your-project-name>.midio.app/event
After creating the bot, go to OAuth & Permissions and click on Install to workspace. This will create a Bot User OAuth Token, which we will use to post a summary to a thread.
Invite the bot by running the following command in a channel: /invite @Article summarizer
Summarize article with Midio
Create a new project in Midio by clicking New project in the Dashboard. In the dialogue, choose the Slack Article Summarizer template.
The template sets up a workflow that summarizes an article if it finds a URL in a user message. This workflow utilizes an LLM agent that receives the content of the article and summarizes it into a Markdown-formatted text.
How it works
The workflow has a Parse event function that parses the Event payload received from Slack and retrieves the URL in the posted message. This URL is then passed to the Extract function in the Tavily package, which will extract the content in the web page. The raw content and the images are passed along to Chat Complete, along with the following prompts:
Note the difference between the system message and user message. In user message, Midio’s expression language is used. This enables us to send images and content as input to the string formatting.


The workflow maintains a list of allowed Slack channel IDs, and will only process events from these. You can configure these yourself in the editor, by modifying the Data object that is sent to Should process event. After verifying that it should process the event, the workflow posts a message as a thread notifying that it is creating a summary. It will update the previously sent message with the summary after it is done summarizing.


Deploy the application
It’s time to deploy the application directly from Midio! You can do this by clicking the hamburger menu on the top-left panel, and selecting Deploy app in the dropdown menu. Make sure you have modified the Event request URL in the Slack configuration to <your-project-name>.midio.app/event.
After deploying the app, verify that it works by pasting a link in the Slack channel where you added the bot.
Next steps
You now have a bot that can summarize articles for you! However, this is just the beginning.
Here are some suggestions for enhancements:
Enable interactivity with Slack’s Slash commands. Maybe users can suggest more clarifications on the summary that the bot posted?
Create a weekly newsletter with all the summaries that the bot has posted that week. Explore the Ephemeral Store module for memory-based state management.
Last updated
Was this helpful?