Skip to content

feat: extract email metadata from file-type messages #191

@derodero24

Description

@derodero24

Problem

When emails are forwarded to a Slack channel (via Slack's email integration), the message content is stored in the files[] array with filetype: "email" rather than in text or blocks. This results in completely empty text output from conversations_history and conversations_search tools.

Example Slack API response for an email message:

{
  "text": "",
  "blocks": [],
  "attachments": [],
  "files": [{
    "filetype": "email",
    "mode": "email",
    "subject": "Meeting Tomorrow",
    "plain_text": "Hi team, please join the meeting at 3pm.",
    "from": [{"name": "John Doe", "address": "john@example.com"}],
    "to": [{"name": "Email", "original": "Email <channel@workspace.slack.com>"}]
  }]
}

The MCP tool currently outputs an empty text column for these messages, even though the email subject and sender information is available in the files[] metadata.

Proposed Solution

Extract email metadata (subject, from) from files[] when:

  • msg.Text is empty
  • BlocksToText(msg.Blocks) returns empty (no Block Kit content)
  • The message contains files with filetype == "email"

This would produce output like: [Email] From: John Doe (john@example.com) Subject: Meeting Tomorrow

Limitations

The plain_text field (email body) is not mapped in the slack-go/slack library's File struct, so only metadata (subject, sender) can be extracted via the standard API. Full email body content can still be retrieved via the existing attachment_get_data tool using the file ID.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions