Connect Slack to ChatGPT: Search History, Files, and Messaging
Learn how to securely connect Slack to ChatGPT using a managed MCP server. Automate message search, file retrieval, and channel history with AI tool calling.
If you need to connect Slack to ChatGPT to automate channel summaries, search historical messages, audit access logs, or manage file uploads, you need a Model Context Protocol (MCP) server. This infrastructure layer acts as the translator between ChatGPT's JSON-RPC tool calls and Slack's native REST APIs. You can either spend weeks writing, hosting, and maintaining a custom Python or Node.js server, or use a managed integration layer to generate a secure, production-ready connection instantly.
If your team uses Claude, check out our guide on connecting Slack to Claude or explore our broader architectural overview on connecting Slack to AI Agents.
Giving a Large Language Model (LLM) read and write access to your company's core communication hub is a massive engineering undertaking. You have to handle OAuth 2.0 token refreshes, translate Slack's specific pagination cursors into LLM instructions, and meticulously define massive JSON schemas for every endpoint. Every time Slack updates a method signature, your code breaks.
This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Slack, connect it natively to ChatGPT, and execute complex workflows using natural language.
The Engineering Reality of the Slack API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against vendor APIs is painful. If you decide to build a custom MCP server for Slack, you own the entire API lifecycle.
Slack's API is notoriously dense, having evolved over a decade from simple Webhooks to a highly structured, tiered REST architecture. Here are the specific integration challenges that break standard CRUD assumptions when working with Slack:
The Conversations Abstraction Layer
In older versions of the Slack API, public channels, private channels, and direct messages (IMs) all had separate endpoint spaces (channels.history, groups.history, im.history). Slack eventually merged these into the conversations API space. While this unified the endpoints, it made querying highly complex. An LLM cannot just ask for "the engineering channel." It has to navigate an API that requires specific boolean filters (types=public_channel,private_channel) to find the correct channel_id, which it must then inject into subsequent conversations.history or conversations.replies calls. Your MCP server must supply exact schema hints to prevent the LLM from hallucinating IDs.
The Multi-Step File Upload V2 Nightmare
Slack deprecated its simple files.upload endpoint. To upload a file to Slack today, your MCP server must handle a strict three-step sequence. First, it must call files.getUploadURLExternal to request a secure upload URL from Slack's infrastructure. Second, it must issue a raw HTTP POST to that specific URL containing the file bytes. Third, it must call files.completeUploadExternal to bind that uploaded file to a channel and finalize the process. If you are building a custom MCP server, you have to write custom orchestration logic to trick the LLM into navigating this sequence, or abstract it away entirely behind a massive custom endpoint.
Tiered Rate Limits and 429 Errors
Slack enforces strict, tiered rate limits across all its endpoints. While chat.postMessage might allow 100 requests per minute (Tier 4), search.messages is capped heavily at 20 requests per minute (Tier 2). If an AI agent attempts to iterate over hundreds of messages or search too rapidly, Slack will reject the payload with an HTTP 429 Too Many Requests status.
Factual note on rate limits: Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream Slack API returns a 429, Truto passes that error directly to the caller. However, Truto extracts the upstream rate limit information and normalizes it into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The MCP client or the calling agent is fully responsible for reading these headers and executing its own exponential backoff.
How to Create a Managed MCP Server for Slack
Rather than building this infrastructure from scratch, Truto dynamically generates an MCP server directly from your connected Slack integration. Truto evaluates the active config.resources and mapped documentation schemas, and builds a JSON-RPC 2.0 compliant endpoint that requires zero maintenance.
There are two ways to generate this server.
Method 1: Via the Truto UI
If you prefer a visual workflow, you can generate the server directly from the dashboard:
- Log into your Truto dashboard and navigate to the Integrated Accounts page.
- Select your connected Slack instance.
- Click the MCP Servers tab in the top navigation.
- Click Create MCP Server.
- Select your desired configuration. You can assign a human-readable name, restrict operations to specific tags, limit access to
readorwritemethods, and set an expiration date. - Click Generate and copy the resulting MCP server URL (e.g.,
https://api.truto.one/mcp/a1b2c3d4e5f6...).
Method 2: Via the API
For engineering teams orchestrating AI access programmatically, you can provision servers on the fly. You send a POST request to the /integrated-account/:id/mcp endpoint with your desired configuration constraints.
const response = await fetch(
'https://api.truto.one/integrated-account/YOUR_SLACK_ACCOUNT_ID/mcp',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TRUTO_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: "Slack Incident Response Agent",
config: {
methods: ["read", "write"],
tags: ["messaging", "search"]
}
})
}
);
const mcpServer = await response.json();
console.log("Your MCP Server URL:", mcpServer.url);The API provisions the cryptographic token, logs the parameters to the database, and returns a fully functional MCP endpoint immediately.
How to Connect the Slack MCP Server to ChatGPT
Once you have the Truto MCP URL, connecting it to ChatGPT takes seconds. The URL contains all the routing and authentication data required to expose the Slack tools to the model.
Method 1: Via the ChatGPT UI
If your ChatGPT account is on a compatible tier (Pro, Plus, Business, Enterprise, or Education), you can add custom connectors directly in the web interface:
- Open ChatGPT and click on your profile to access Settings.
- Navigate to Apps and open Advanced settings.
- Toggle on Developer mode.
- Under MCP servers / Custom connectors, click Add new server.
- Enter a recognizable name (e.g., "Production Slack").
- Paste the Truto MCP URL into the Server URL field.
- Save the configuration.
ChatGPT will immediately ping the server's initialize endpoint, perform the handshake, and load all available Slack tools.
Method 2: Via Manual Configuration File (for local dev)
If you are running local experiments with agents or building custom desktop environments that utilize ChatGPT's underlying models, you can connect the server using standard Server-Sent Events (SSE) via the MCP CLI.
Add the following configuration to your mcp.json or equivalent agent config file:
{
"mcpServers": {
"slack-production": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"--url",
"https://api.truto.one/mcp/YOUR_SECURE_TOKEN"
]
}
}
}Hero Tools for Slack
Truto automatically generates comprehensive tool schemas derived from Slack's documentation, injecting explicit LLM instructions - such as telling the model to return pagination cursors unmodified. Here are 6 high-leverage hero tools your AI agent can use once connected.
list_all_slack_search
Search messages and files matching a query in Slack. This is one of the most powerful tools for an LLM, allowing it to perform semantic or keyword lookups across the entire workspace history to gather context before taking action.
"Search Slack for any error logs mentioning 'database connection timeout' posted in the last 48 hours."
list_all_slack_conversation_history
Get message history for a conversation in Slack by channel ID. This returns an array of messages with message type, user, text, and timestamp fields. It is essential for summarizing threads or getting caught up on incident response channels.
"Fetch the last 50 messages from the #eng-incidents channel and summarize the current status of the outage."
create_a_slack_chat
Send a message to a channel in Slack. Requires a channel ID and at least one payload parameter (text, attachments, or blocks). The model can use this to report its findings, alert team members, or log automated status updates.
"Post a message in the #general channel announcing that the automated deployment completed successfully, and format it with bold text."
list_all_slack_users
Get a list of all users in the Slack workspace. This returns heavily detailed user objects including ID, team ID, deleted status, real name, timezone info, and admin/bot flags. Essential for mapping names to Slack IDs for @mentions.
"List all users in the workspace who have the admin or owner flag enabled."
list_all_slack_files
List files filtered by channel, user, team ID, or timestamp. Returns file objects including ID, name, mimetype, user, size, and permalinks. The agent uses this to track down scattered PDFs, error log uploads, or design assets.
"Find all PDF files uploaded by jane.doe@example.com in the #design channel during the month of October."
list_all_slack_team_access_logs
Get access logs for the current team in Slack. Returns critical security metadata including user_id, username, IP address, user agent, ISP, country, and region for each login entry. Perfect for automated compliance and security audits.
"Pull the most recent access logs and flag any logins originating from outside the United States."
To view the complete inventory of available methods, endpoints, and schema definitions, visit the Truto Slack Integration Page.
Workflows in Action
Exposing these tools to ChatGPT transforms it from a static conversational interface into an active participant in your company's operations. Here are three concrete workflows you can execute using the Truto MCP server.
Workflow 1: Incident Response Context Gathering
When a major alert triggers, responders need context immediately. Instead of scrolling through multiple channels, an engineer can ask ChatGPT to build an incident brief.
"We have an ongoing outage. Find any Slack messages mentioning 'Redis cluster failure' from the last 3 hours, then look up the recent history of the #devops-alerts channel, and write a summary of the timeline. Post the final summary back to #eng-leadership."
Execution Steps:
list_all_slack_search: The agent searches for the string "Redis cluster failure", retrieving message timestamps and channel IDs where the discussion began.list_all_slack_conversation_history: The agent pulls the last 50-100 messages from the identified #devops-alerts channel to understand the sequential flow of the incident.create_a_slack_chat: The agent formats a timeline summary using Slack blocks and posts it directly to the #eng-leadership channel.
Workflow 2: Automated Offboarding Audit
Security teams frequently need to audit workspace usage to ensure former contractors or offboarded employees no longer have access.
"Find the user ID for John Smith, check the team access logs to see if he has logged in during the past 7 days, and verify if he has uploaded any files to public channels since his contract ended."
Execution Steps:
list_all_slack_users: The agent fetches the user list, matches the string "John Smith", and extracts his exact Slackuser_id.list_all_slack_team_access_logs: The agent queries the access logs, filtering the results locally to identify any timestamps associated with John'suser_idover the last week.list_all_slack_files: Using the extracteduser_id, the agent filters the file repository to check for any unexpected data exfiltration or recent uploads.
Workflow 3: Cross-Channel Knowledge Extraction
Information gets buried in Slack. An AI agent can extract knowledge locked inside disparate threads and consolidate it for new hires.
"Search for messages discussing the 'API Gateway migration strategy', extract the key decisions, and DM the summary to me."
Execution Steps:
list_all_slack_search: The agent queries the workspace for "API Gateway migration strategy".list_all_slack_conversation_replies: If the search results indicate the decisions were made deep inside a thread, the agent uses thets(timestamp) andchannel_idto pull the specific thread replies.list_all_slack_me: The agent looks up the authenticated user's profile to get their ID.create_a_slack_conversations_open: The agent initiates an IM channel with the user.create_a_slack_chat: The agent sends the consolidated findings.
Security and Access Control
Giving an LLM access to your Slack workspace introduces risk. Truto's MCP implementation includes strict, dynamic access controls enforced at the server level, ensuring the AI agent can never exceed its mandate.
- Method Filtering (
methods): Restrict the server to specific operation types. By passing["read"]during creation, the server drops allcreate,update, anddeletetools. The agent physically cannot post messages or alter data, no matter how hard it is prompted. - Tag Filtering (
tags): Scope access to functional areas. If you only want the AI to manage users, you can apply a["directory"]tag filter, completely hiding the messaging and file upload tools from the LLM. - API Token Authentication (
require_api_token_auth): By default, possessing the MCP URL grants access. By enabling this flag, Truto forces the client to pass a valid Truto API token in theAuthorizationheader, preventing unauthorized execution if the URL leaks in logs. - Automated Expiration (
expires_at): For temporary workflows - like granting a contractor's AI agent access during a two-week sprint - you can supply an ISO datetime. Truto's serverless infrastructure automatically revokes the token and purges the server at the exact timestamp.
Escaping the Slack API Boilerplate
Connecting Slack to ChatGPT unlocks incredible operational leverage, but building the bridge shouldn't consume your engineering team's bandwidth. Writing cursor pagination loops, handling multipart form file uploads, and maintaining massive schema files distracts you from building actual product features.
Truto's documentation-driven MCP generation turns complex APIs into ready-to-use LLM tools instantly. You manage the configuration and access controls; Truto handles the protocol translation, normalization, and infrastructure.
FAQ
- How does ChatGPT authenticate with the Slack MCP server?
- The MCP server URL itself contains a cryptographically secure token that authenticates the connection to the specific Slack workspace. For added security, you can enforce an additional API token check requiring the client to pass a Truto API token in the Authorization header.
- Does Truto automatically handle Slack rate limits for AI agents?
- No. Truto maps upstream rate limit headers into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) and passes HTTP 429 Too Many Requests errors directly back to the caller. The AI agent or client must implement its own exponential backoff and retry logic.
- Can I limit ChatGPT to only read messages in Slack?
- Yes. When creating the MCP server in Truto, you can use method filtering to restrict the server's capabilities. Setting the configuration to allow only 'read' methods ensures ChatGPT can search and fetch history but cannot post messages or modify files.
- Does this work with ChatGPT's free tier?
- Using custom MCP connectors natively in the ChatGPT UI requires a ChatGPT account with Developer Mode enabled, which is typically restricted to Pro, Plus, Business, Enterprise, and Education tiers.