Skip to content

feat: add Slack action #46

Description

@nicosammito

Summary

Add a Slack action so Hercules flows can post messages, react to Slack events, and drive channel/user operations — the canonical "notify a human / capture a human decision" step in automation. Slack is one of the single most-used integrations on both n8n and Zapier, pairing naturally with the e-commerce and comms actions already in centaurus (e.g. a Shopify order or GLS shipment posting an alert to a Slack channel).

n8n/Zapier validation: Slack has a flagship first-party node on n8n and is consistently among the top apps on Zapier for "send channel message" / "notify on new record" automations.

Suggested directory

actions/slack-action

Triggers

Slack pushes events via the Events API over HTTP (with URL verification + signed requests) — this maps onto the existing Rest-based event pattern used by the Shopify action (event classes extend Rest, payload registered as a data type). The Slack signing secret is used to validate the X-Slack-Signature / X-Slack-Request-Timestamp headers.

  • SlackMessagePosted — new message in a watched channel (setting: channelId; message.channels event)
  • SlackAppMentioned — the bot was @-mentioned (app_mention)
  • SlackReactionAdded — reaction added to a message (reaction_added) — enables approval/reaction-role flows
  • SlackChannelCreated — new channel created (channel_created)
  • SlackSlashCommand — a registered slash command was invoked (setting: commandName)

Functions

  • slackPostMessage(channelId, text, blocks?): SLACK_MESSAGE
  • slackReplyInThread(channelId, threadTs, text, blocks?): SLACK_MESSAGE
  • slackUpdateMessage(channelId, ts, text, blocks?): SLACK_MESSAGE
  • slackDeleteMessage(channelId, ts): BOOLEAN
  • slackAddReaction(channelId, ts, emoji): BOOLEAN
  • slackSendDirectMessage(userId, text, blocks?): SLACK_MESSAGE — opens an IM channel then posts
  • slackUploadFile(channelId, filename, content, title?): SLACK_FILE
  • slackCreateChannel(name, isPrivate?): SLACK_CHANNEL
  • slackInviteToChannel(channelId, userIds): SLACK_CHANNEL
  • slackGetUserByEmail(email): SLACK_USER
  • slackSetChannelTopic(channelId, topic): SLACK_CHANNEL

Utils (data-type builders, mirroring GLS create* utils): slackCreateBlock(...), slackCreateTextSection(...) — assemble Block Kit payloads.

Data types

One class per file in src/data_types/ (zod schema + @Identifier/@Name/@Schema), plus event payload schemas per trigger:

  • SlackMessage, SlackChannel, SlackUser, SlackFile, SlackReaction, SlackBlock
  • Event payloads: SlackMessagePostedEventPayload, SlackAppMentionEventPayload, SlackReactionAddedEventPayload, SlackSlashCommandPayload

Auth / config via ConfigurationDefinition on the Action (like GLS client_id/client_secret):

Identifier Type Description
bot_token TEXT Bot user OAuth token (xoxb-…, Bearer) for the Web API
signing_secret TEXT Slack signing secret, used to validate inbound Events API request signatures
app_token TEXT (optional) App-level token (xapp-…) if Socket Mode is preferred over public HTTP endpoints

Beyond the shared Hercules vars (HERCULES_AUTH_TOKEN, HERCULES_AQUILA_URL, HERCULES_ACTION_ID, HERCULES_SDK_VERSION) an action-specific SLACK_BOT_TOKEN / SLACK_SIGNING_SECRET may back the config defaults.

Rationale

Team-communication domain, distinct from everything currently in the repo. Not implemented (gls, shopify, shopware, twilio, woocommerce), not on an in-development branch (stripe, github, hubspot/twilio), and not in any open issue/PR (Google Sheets #43, Notion #42, HubSpot #41/#44, S3 #38, SFTP #37, MCP #40, Stripe #35, Discord #34, GitHub #26, SMTP #20, Cron #15, Rest #14, AI #2, WebSocket #16, MQTT #13). Distinct from the planned Discord action (#34): Slack targets workplace/team messaging with Block Kit + slash commands and its own Events API/signing model, versus Discord's gateway/discord.js model — different SDK, auth, and audience. Twilio (#33) covers SMS/voice, not team chat, and SMTP (#20) is one-way email. Slack gives flows the ubiquitous "post to a channel / ask a human / capture a reaction" step that complements every other action.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions