> ## Documentation Index
> Fetch the complete documentation index at: https://moonshadow-ep3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Your First Integration to Moonshadow

> Step-by-step guide to connecting Slack to Moonshadow, configuring event triggers, and sending your first automated notification in under 10 minutes.

This guide walks you through connecting Slack to Moonshadow as your first integration. You will authorize the connection, configure event triggers, and test that notifications flow from your connected tools into Moonshadow automatically.

## Prerequisites

Before you begin, make sure you have:

* A Moonshadow account with an active workspace
* Admin or Editor permissions in that workspace
* A Slack workspace where you can install apps
* Your Moonshadow API key from the dashboard

<Note>
  Only workspace Admins and Editors can add integrations. If you do not see the Integrations section, ask your workspace Admin to grant you the Editor role.
</Note>

## Step 1: Open the Integrations Dashboard

Log in to Moonshadow and navigate to your workspace. In the left sidebar, click **Integrations**. This page lists all available integrations and shows which ones are currently active.

<Steps>
  <Step title="Log in to Moonshadow">
    Go to [https://app.moonshadow.dev](https://app.moonshadow.dev) and sign in to your account.
  </Step>

  <Step title="Select your workspace">
    Choose the workspace where you want to add the integration.
  </Step>

  <Step title="Open Integrations">
    Click **Integrations** in the left sidebar to view the available integrations catalog.
  </Step>
</Steps>

## Step 2: Connect Slack

Find Slack in the integrations list and click **Connect**. Moonshadow redirects you to Slack to authorize the connection. After you approve the OAuth scopes, Slack redirects back to Moonshadow and the integration becomes active.

Alternatively, you can connect Slack programmatically using the Moonshadow API:

```bash theme={null}
curl -X POST https://api.moonshadow.dev/v1/integrations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "slack",
    "workspace_id": "ws_1234567890abcdef",
    "config": {
      "channel": "#general",
      "notify_on": ["event.created", "automation.completed"]
    }
  }'
```

<Warning>
  Keep your API key secure. Do not commit it to version control or share it in public repositories.
</Warning>

## Step 3: Configure Event Triggers

After connecting Slack, decide which events should trigger notifications. Event triggers define when Moonshadow sends a message to your Slack channel.

Common trigger options include:

* `event.created` - fires when a new event is received from any integration
* `automation.completed` - fires when an automation workflow finishes
* `integration.connected` - fires when a new integration is added to the workspace
* `user.invited` - fires when a new team member is invited

You can configure triggers through the dashboard by clicking **Configure** next to your Slack integration, or via API:

```bash theme={null}
curl -X PATCH https://api.moonshadow.dev/v1/integrations/int_abc123 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "config": {
      "channel": "#alerts",
      "notify_on": ["event.created", "automation.completed"],
      "filters": {
        "severity": ["high", "critical"]
      }
    }
  }'
```

<Tip>
  Start with just one or two trigger types to avoid notification overload. You can always add more triggers later.
</Tip>

## Step 4: Test the Integration

Send a test event to verify that Slack receives notifications correctly. You can trigger a test from the dashboard by clicking **Send Test** on the Slack integration card, or use the API directly:

```bash theme={null}
curl -X POST https://api.moonshadow.dev/v1/integrations/int_abc123/test \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "event.created",
    "payload": {
      "message": "This is a test notification from Moonshadow"
    }
  }'
```

Expected response:

```json theme={null}
{
  "success": true,
  "integration_id": "int_abc123",
  "event_type": "event.created",
  "delivered_at": "2024-01-15T10:30:00Z",
  "destination": "#alerts"
}
```

If the test succeeds, check your Slack channel for the test message. If it fails, review the error message in the response or check the integration logs in the Moonshadow dashboard.

## Step 5: View Events in the Dashboard

All events and deliveries are logged in the Moonshadow dashboard. Navigate to **Events** in the left sidebar to see a timeline of every event that fired, including:

* Event type and timestamp
* Source integration
* Delivery status (delivered, failed, retrying)
* Payload summary

From the Events page, you can filter by integration, event type, or status. Click any event to see the full payload and delivery details.

## Next Steps

Now that Slack is connected, you can:

* <Card title="Set up Webhooks" icon="webhook" href="/guides/webhooks">
    Receive real-time events on your own server
  </Card>
* <Card title="Configure Notifications" icon="bell" href="/guides/notifications">
    Build advanced notification rules with filters and multiple channels
  </Card>
