← All tools

Communication

Slack Webhook

Post messages to Slack via an incoming webhook.

slack_webhook

Overview

Posts a message into a Slack channel. The fastest way for an agent to tell your team something important — an alert, a completed deployment, or a summary of what it just did.

How it works

Posts the supplied message text (Slack-flavored markdown accepted) to a Slack Incoming Webhook URL. Optional 'channel' and 'username' overrides let you redirect without changing the webhook. Validates that the URL starts with https://hooks.slack.com/ and caps message length at 40,000 characters.

Example

When a user asks:

Post today's deployment summary to the #ops channel.

the agent calls the tool:

slack_webhook(text="Deploy complete: v2.3.1 live in prod")

and gets back: confirmation that Slack accepted the message.

Configuration

Set these before calling the tool. Values marked required must be present or the tool call will fail.

slack.webhook.url required

Incoming webhook URL. Can also be passed per-call as 'webhook_url'. Must start with https://hooks.slack.com/.

Use it in a workflow

Wire this tool into a SwarmAI crew. Use the YAML DSL for declarative workflows, or the Java builder API when you want full programmatic control.

YAML DSL

# team-alert.yaml
name: team-alert-crew
process: SEQUENTIAL

agents:
  - id: notifier
    role: Team Notifier
    goal: Broadcast updates to team Slack channels
    tools:
      - slack_webhook

tasks:
  - id: team-alert-task
    agent: notifier
    description: Post today's deployment summary to the #ops channel.

Java

import ai.intelliswarm.swarmai.agent.Agent;
import ai.intelliswarm.swarmai.task.Task;
import ai.intelliswarm.swarmai.swarm.Swarm;
import ai.intelliswarm.swarmai.swarm.SwarmOutput;
import ai.intelliswarm.swarmai.process.ProcessType;
import ai.intelliswarm.swarmai.tool.common.SlackWebhookTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;

@Autowired ChatClient chatClient;
@Autowired SlackWebhookTool slackWebhookTool;

Agent notifier = Agent.builder()
    .role("Team Notifier")
    .goal("Broadcast updates to team Slack channels")
    .chatClient(chatClient)
    .tool(slackWebhookTool)
    .build();

Task notifierTask = Task.builder()
    .description("Post today's deployment summary to the #ops channel.")
    .agent(notifier)
    .build();

SwarmOutput result = Swarm.builder()
    .agent(notifier)
    .task(notifierTask)
    .process(ProcessType.SEQUENTIAL)
    .build()
    .kickoff();

What it's good for

Real scenarios where agents put this tool to work.

Alerting an engineering channel when a monitoring agent flags an anomaly
Posting research digests to a team channel
Deploy-complete messages with links to artifacts
On-call alerting when CVE lookups return critical matches

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/common/SlackWebhookTool.java in the swarm-ai repository.

Open slack_webhook on GitHub →