Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_interactive_message

Send Slack messages with interactive buttons to collect user responses, trigger actions, or gather feedback directly in channels or threads.

Instructions

Send an interactive message with buttons.

Args: channel: Channel ID or name title: Message title description: Message description buttons: JSON string of button configurations [{"text": "Button Text", "action_id": "action_1", "style": "primary"}] thread_ts: Thread timestamp for replies (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
titleYes
descriptionYes
buttonsYes
thread_tsNo

Implementation Reference

  • The primary handler function for the 'send_interactive_message' MCP tool. Decorated with @mcp.tool() for registration. Parses button JSON, builds interactive Block Kit blocks using BlockKitBuilder, and sends the message via SlackClient.
    @mcp.tool()
    async def send_interactive_message(
        channel: str,
        title: str,
        description: str,
        buttons: str,
        thread_ts: Optional[str] = None
    ) -> str:
        """
        Send an interactive message with buttons.
    
        Args:
            channel: Channel ID or name
            title: Message title
            description: Message description
            buttons: JSON string of button configurations [{"text": "Button Text", "action_id": "action_1", "style": "primary"}]
            thread_ts: Thread timestamp for replies (optional)
        """
        try:
            blocks = [
                BlockKitBuilder.header(title),
                BlockKitBuilder.section(description)
            ]
            
            # Parse button configurations
            button_configs = json.loads(buttons)
            button_elements = []
            
            for btn_config in button_configs:
                button = BlockKitBuilder.button(
                    text=btn_config["text"],
                    action_id=btn_config["action_id"],
                    value=btn_config.get("value"),
                    url=btn_config.get("url"),
                    style=btn_config.get("style")
                )
                button_elements.append(button)
            
            if button_elements:
                blocks.append(BlockKitBuilder.actions(*button_elements))
            
            fallback_text = f"{title}: {description}"
            
            client = SlackClient()
            result = await client.send_message(channel, fallback_text, thread_ts, blocks)
            return json.dumps(result, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)}, indent=2)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/piekstra/slack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server