Send Message
Sends a message to a Slack channel or direct message. This action supports rich formatting, attachments, blocks, threading, and various customization options for comprehensive Slack messaging.
Overview
- Purpose: Send messages to Slack channels or direct messages programmatically.
- Use Cases: Automated notifications, alerts, workflow updates, bot responses, customer communications, team notifications, integration updates.
- API Method: POST /messages
- Slack API: Uses Slack’s
chat.postMessageAPI method. - Required Scopes:
chat:write,users:read.email,im:write
Destination Options
- Channel ID: Provide a Slack channel ID (e.g., ‘C1234567890’) to send to a specific channel.
- User Email: Provide a user’s email address to send a direct message. The action automatically resolves the user and opens a DM channel.
- Required: You must provide either a channel ID or user email - at least one is required.
- Channel Format: Channel IDs start with ‘C’ for public channels, ‘G’ for private channels/groups, ‘D’ for DMs.
Required Input Fields
Channel OR User Email: Specify either ‘channel’ (channel ID) or ‘useremailid’ (user email address).
Text: Message text content (optional if using blocks or attachments, but recommended for notifications).
Message Content Options
- Text: Plain text or Slack mrkdwn formatted message content.
- Blocks: JSON string containing Block Kit blocks for rich, interactive messages.
- Attachments: JSON string containing legacy message attachments (deprecated, use blocks instead).
- Markdown Text: Alternative markdown text field (max 12,000 characters).
Message Formatting
- Mrkdwn: Set to false to disable Slack markup parsing (default: true).
- Parse: Change how messages are treated (‘full’ or ‘none’).
- Link Names: Set to true to find and link user groups and channels.
- Unfurl Links: Enable/disable automatic unfurling of text-based content.
- Unfurl Media: Enable/disable automatic unfurling of media content.
Bot Customization
- Username: Override the bot’s display name for this message.
- Icon Emoji: Set a custom emoji as the bot’s avatar (e.g., ‘:chart_with_upwards_trend:’).
- Icon URL: Set a custom image URL as the bot’s avatar.
- As User: Legacy parameter for classic apps to post as the authenticated user.
Threading and Replies
- Thread TS: Timestamp of the parent message to reply to (creates a threaded reply).
- Reply Broadcast: Set to true to make the threaded reply visible to everyone in the channel.
- Threading: Use thread_ts to keep conversations organized in threads.
Advanced Options
- Metadata: JSON string with event_type and event_payload for message metadata.
- Current Draft Last Updated TS: Timestamp for draft message updates.
- Blocks: Use Block Kit for interactive elements, buttons, menus, and rich formatting.
- Attachments: Legacy structured attachments (use blocks for new implementations).
Direct Message Workflow
- Step 1: Action looks up the user by email using
users.lookupByEmailAPI. - Step 2: Action opens a DM conversation using
conversations.openAPI. - Step 3: Message is sent to the resolved DM channel.
- Automatic: This entire process is handled automatically when you provide a user email.
Output
- OK: Boolean indicating if the message was sent successfully.
- Channel: The channel ID where the message was posted.
- TS (Timestamp): Unique timestamp identifier for the sent message (use for threading or updates).
- Message: The complete message object that was posted.
- Warning: Any warnings from Slack API.
- Error: Error message if the send failed.
- Raw JSON: Complete raw response from Slack API.
Required Permissions
[!IMPORTANT] chat:write: Required to send messages to channels.
[!IMPORTANT] users:read.email: Required to look up users by email for DMs.
[!IMPORTANT] im:write: Required to send direct messages to users.
- User Consent: Users must grant these permissions during OAuth flow.
Error Handling
- Missing Destination: Throws error if neither channel nor user email is provided.
- Invalid Channel: Slack returns error if channel ID doesn’t exist or bot lacks access.
- User Not Found: Throws error if user email doesn’t match any Slack user.
- DM Failure: Throws error if unable to open DM conversation with user.
- Retry Logic: Automatically retries failed requests up to 3 times.
Tips
[!TIP] Use channel IDs instead of names for reliability - channel names can change
[!TIP] For DMs, provide user email - the action handles user lookup and channel opening automatically
[!TIP] Save the returned ‘ts’ (timestamp) to reply in threads or update messages later
[!TIP] Use Block Kit (blocks parameter) for rich, interactive messages instead of legacy attachments
[!TIP] Test messages in a test channel before sending to production channels
[!TIP] Set unfurl_links to false for cleaner messages without automatic link previews
[!TIP] Use thread_ts to keep related messages organized in threads
[!TIP] Customize bot appearance with username and icon_emoji for better user experience
[!WARNING] Keep text under 40,000 characters (Slack’s limit) and markdown_text under 12,000
[!WARNING] Use reply_broadcast sparingly - it notifies all channel members
[!TIP] For formatted messages, use Slack’s mrkdwn syntax (bold, italic,
code)
[!TIP] Include fallback text even when using blocks for notification compatibility
[!TIP] Store message timestamps for message updates or deletion workflows
[!TIP] Use metadata field to attach custom data for tracking and analytics
[!IMPORTANT] Ensure your OAuth flow requests all three required scopes (chat:write, users:read.email, im:write)