Slack Integration Example
Send intelligent notifications to Slack channels using AI-generated summaries and smart formatting.
Workflow Definition
name: slack-integrationdescription: | AI-powered Slack notification workflow that analyzes events, generates intelligent summaries, and posts formatted messages to Slack channels.version: "1.0"
inputs: - name: event_type type: string required: true description: Type of event (build, deployment, alert, issue, etc.)
- name: status type: string required: true description: Event status (success, failed, warning, critical, etc.)
- name: details type: string required: true description: Event details or log content to summarize
- name: channel type: string required: true description: Slack channel (e.g., "#engineering" or "C1234567890")
- name: mention_users type: string required: false description: Users to mention (comma-separated, e.g., "@john,@jane")
steps: # Step 1: Generate intelligent summary - id: generate_summary name: Generate Event Summary type: llm model: fast system: | You are an expert at creating concise, actionable summaries for engineering teams.
Create a brief summary (2-3 sentences) that captures: - What happened - Impact or significance - Next steps (if any)
Keep it clear, technical, and actionable. Use technical terminology appropriately. prompt: | Summarize this {{.event_type}} event:
**Status:** {{.status}}
**Details:** {{.details}}
Create a concise summary for a Slack notification. timeout: 15
# Step 2: Determine message urgency and formatting - id: format_message name: Format Slack Message type: llm model: fast system: | You are a Slack message formatter. Create a well-formatted message using Slack's mrkdwn syntax.
Use these formatting rules: - *bold* for emphasis - `code` for technical terms - > blockquote for important notes - Emoji for status (✅ success, ❌ failed, ⚠️ warning, 🚨 critical)
Structure: [emoji] **[Event Type]: [Status]**
[Summary]
[Additional details if needed] prompt: | Format this event for Slack:
**Event Type:** {{.event_type}} **Status:** {{.status}} **Summary:** {{$.generate_summary.content}}
{{if .mention_users}} **Mention:** {{.mention_users}} {{end}}
Create a well-formatted Slack message with appropriate emoji and formatting. Return ONLY the formatted message text, no explanations. timeout: 15
# Step 3: Post to Slack via HTTP # Note: Requires SLACK_BOT_TOKEN environment variable - id: post_to_slack name: Post Message to Slack http.post: url: "https://slack.com/api/chat.postMessage" headers: Authorization: "Bearer ${SLACK_BOT_TOKEN}" Content-Type: "application/json" body: channel: "{{.inputs.channel}}" text: "{{.steps.format_message.content}}"
outputs: - name: summary type: string value: "{{.steps.generate_summary.content}}" description: Generated event summary
- name: message type: string value: "{{.steps.format_message.content}}" description: Formatted Slack message
- name: slack_response type: object value: "{{.steps.post_to_slack}}" description: Slack API response with message timestampQuick Start
# Send build notificationconductor run examples/slack-integration \ --input event_type="build" \ --input status="success" \ --input details="All tests passed. Build completed in 3m 42s." \ --input channel="#builds"
# Send critical alert with mentionsconductor run examples/slack-integration \ --input event_type="alert" \ --input status="critical" \ --input details="Database connection pool exhausted" \ --input channel="#oncall" \ --input mention_users="@oncall-team"Prerequisites
- Conductor CLI installed
- Slack Bot Token with
chat:writepermission - Set environment variable:
export SLACK_BOT_TOKEN="xoxb-your-token" - Invite bot to your Slack channel
Features
- AI-powered event summarization
- Smart Slack mrkdwn formatting
- Automatic emoji selection based on status
- Support for user mentions
- Thread support for updates
Use Cases
- CI/CD pipeline notifications
- Deployment announcements
- System alerts and monitoring
- Issue tracking updates
Expected Output
✅ **Build: Success**
Build completed successfully in 3m 42s. All test suites passed with 245 tests. No new warnings or linting issues detected.Documentation
For detailed usage, customization options, and integration patterns, see: Slack Integration Documentation