Claude Code Plugins

Community-maintained marketplace

Feedback

slack-integration

@benchflow-ai/skillsbench
17
0

Send messages and notifications to Slack channels using webhooks and APIs. Use when posting invoice alerts to team channels, sending payment notifications, automating status updates, or integrating invoice workflows with Slack.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name slack-integration
description Send messages and notifications to Slack channels using webhooks and APIs. Use when posting invoice alerts to team channels, sending payment notifications, automating status updates, or integrating invoice workflows with Slack.

Slack Integration

Provides patterns for sending notifications and messages to Slack.

Webhook Messages

import requests
from typing import Dict, List, Optional

def send_slack_message(webhook_url: str, message: str) -> bool:
    """
    Send simple message via Slack webhook.

    Usage:
        send_slack_message(
            webhook_url="https://hooks.slack.com/services/xxx/yyy/zzz",
            message="New invoice processed: INV-001"
        )
    """
    payload = {"text": message}
    response = requests.post(webhook_url, json=payload)
    return response.status_code == 200

def send_slack_block_message(webhook_url: str, blocks: List[Dict]) -> bool:
    """
    Send formatted block message.

    Usage:
        blocks = [
            {"type": "header", "text": {"type": "plain_text", "text": "Invoice Alert"}},
            {"type": "section", "text": {"type": "mrkdwn", "text": "*INV-001* is ready"}}
        ]
        send_slack_block_message(webhook_url, blocks)
    """
    payload = {"blocks": blocks}
    response = requests.post(webhook_url, json=payload)
    return response.status_code == 200

Invoice Notification Blocks

def create_invoice_notification_blocks(
    invoice_number: str,
    amount: float,
    vendor: str,
    due_date: str,
    status: str = "pending"
) -> List[Dict]:
    """
    Create formatted invoice notification blocks.

    Usage:
        blocks = create_invoice_notification_blocks(
            invoice_number="INV-001",
            amount=1500.00,
            vendor="Acme Corp",
            due_date="2024-02-15",
            status="approved"
        )
        send_slack_block_message(webhook_url, blocks)
    """
    status_emoji = {
        "pending": ":hourglass:",
        "approved": ":white_check_mark:",
        "paid": ":moneybag:",
        "overdue": ":warning:",
        "rejected": ":x:"
    }.get(status, ":page_facing_up:")

    return [
        {
            "type": "header",
            "text": {
                "type": "plain_text",
                "text": f"{status_emoji} Invoice Notification"
            }
        },
        {
            "type": "section",
            "fields": [
                {"type": "mrkdwn", "text": f"*Invoice:*\n{invoice_number}"},
                {"type": "mrkdwn", "text": f"*Amount:*\n${amount:,.2f}"},
                {"type": "mrkdwn", "text": f"*Vendor:*\n{vendor}"},
                {"type": "mrkdwn", "text": f"*Due Date:*\n{due_date}"},
            ]
        },
        {
            "type": "context",
            "elements": [
                {"type": "mrkdwn", "text": f"Status: *{status.upper()}*"}
            ]
        }
    ]

Batch Summary Notification

def create_batch_summary_blocks(
    title: str,
    total_invoices: int,
    total_amount: float,
    breakdown: Dict[str, int]
) -> List[Dict]:
    """
    Create summary notification for batch processing.

    Usage:
        blocks = create_batch_summary_blocks(
            title="Daily Invoice Processing Complete",
            total_invoices=25,
            total_amount=45000.00,
            breakdown={"processed": 23, "errors": 2}
        )
    """
    breakdown_text = "\n".join(f"- {k}: {v}" for k, v in breakdown.items())

    return [
        {
            "type": "header",
            "text": {"type": "plain_text", "text": title}
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": f"*Total Invoices:* {total_invoices}\n*Total Amount:* ${total_amount:,.2f}"
            }
        },
        {"type": "divider"},
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": f"*Breakdown:*\n{breakdown_text}"
            }
        }
    ]

Alert with Actions

def create_approval_request_blocks(
    invoice_number: str,
    amount: float,
    vendor: str,
    approver_id: str
) -> List[Dict]:
    """
    Create invoice approval request with action buttons.

    Note: Action buttons require Slack app integration, not just webhooks.
    """
    return [
        {
            "type": "header",
            "text": {"type": "plain_text", "text": ":page_facing_up: Approval Required"}
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": f"<@{approver_id}> - Invoice *{invoice_number}* requires your approval."
            }
        },
        {
            "type": "section",
            "fields": [
                {"type": "mrkdwn", "text": f"*Amount:*\n${amount:,.2f}"},
                {"type": "mrkdwn", "text": f"*Vendor:*\n{vendor}"}
            ]
        },
        {
            "type": "actions",
            "elements": [
                {
                    "type": "button",
                    "text": {"type": "plain_text", "text": "Approve"},
                    "style": "primary",
                    "value": f"approve_{invoice_number}"
                },
                {
                    "type": "button",
                    "text": {"type": "plain_text", "text": "Reject"},
                    "style": "danger",
                    "value": f"reject_{invoice_number}"
                }
            ]
        }
    ]

Error Notifications

def send_error_notification(
    webhook_url: str,
    error_type: str,
    error_message: str,
    context: Dict = None
):
    """Send error notification to Slack."""
    context_text = ""
    if context:
        context_text = "\n".join(f"- {k}: {v}" for k, v in context.items())

    blocks = [
        {
            "type": "header",
            "text": {"type": "plain_text", "text": ":rotating_light: Error Alert"}
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": f"*Error Type:* {error_type}\n*Message:* {error_message}"
            }
        }
    ]

    if context_text:
        blocks.append({
            "type": "section",
            "text": {"type": "mrkdwn", "text": f"*Context:*\n{context_text}"}
        })

    send_slack_block_message(webhook_url, blocks)

Helper Script

Use helper.py for the SlackNotifier class with error handling and retry logic.