> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evomarketing.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> Slack integration for team notifications and client updates

EVO Dialed integrates with Slack for internal notifications and client workspace connections.

## Integration types

### Internal notifications

EVO team Slack workspace receives:

* Sync status reports
* Health alerts
* Daily metrics

### Client workspace

Brand clients can connect their Slack:

* Strategy updates
* Weekly reports
* Bidirectional chat sync (optional)

## Internal Slack

### Webhook notifications

Notifications sent via webhook:

| Notification  | Trigger              | Channel      |
| ------------- | -------------------- | ------------ |
| Sync start    | Daily sync begins    | Sync channel |
| Sync complete | Daily sync finishes  | Sync channel |
| Credits low   | API credits depleted | Sync channel |
| Daily metrics | Morning summary      | General      |

### Configuration

| Variable                        | Purpose               |
| ------------------------------- | --------------------- |
| `SCRAPE_SYNC_SLACK_WEBHOOK_URL` | Sync alerts webhook   |
| `SLACK_GENERAL_WEBHOOK_URL`     | General notifications |

## Client workspace

### OAuth connection

1. Navigate to brand detail → Integrations
2. Click "Connect Slack"
3. Client authorizes EVO app
4. Select notification channel
5. Connection active

### Notifications sent

| Event                  | Message                    |
| ---------------------- | -------------------------- |
| Strategy published     | Strategy summary with link |
| Weekly report          | Report link and highlights |
| Weekly strategy update | Strategy content           |

### Bidirectional chat

Optional feature linking EVO chat to Slack:

```
EVO Chat Channel ↔ Slack Channel
```

Messages sync both directions:

* EVO messages appear in Slack
* Slack messages appear in EVO

## Implementation

### Slack client

**File:** `app/services/integrations/slack_client.rb`

```ruby theme={null}
client = Integrations::SlackClient.new(webhook_url: url)
client.post_message(text: "Hello!", channel: "#general")
```

### Strategy Slack update

**File:** `app/services/brands/strategy_slack_update.rb`

Sends formatted strategy summary:

* Key points
* Link to full strategy
* Brand branding

### Weekly report sender

**File:** `app/services/weekly_reports/sender.rb`

Sends report notification:

* Metric highlights
* Direct link to report
* Comparison to previous week

## Channel linking

### Setup

1. Admin connects brand to Slack
2. Select EVO channel to link
3. Select Slack channel to link
4. Enable bidirectional sync

### Models

| Model                | Purpose               |
| -------------------- | --------------------- |
| `Slack::Workspace`   | Connected workspace   |
| `Slack::ChannelLink` | Channel mapping       |
| `Slack::MessageLink` | Message sync tracking |

## Webhook handling

### Events endpoint

**File:** `app/controllers/api/webhooks/slack_controller.rb`

Handles:

* Message events
* Channel updates
* User presence

## Error handling

| Error                  | Handling          |
| ---------------------- | ----------------- |
| Workspace disconnected | Require re-auth   |
| Channel archived       | Disable link      |
| Rate limited           | Backoff and retry |
| Message failed         | Log and continue  |

## Backend files

| File                                               | Purpose         |
| -------------------------------------------------- | --------------- |
| `app/services/integrations/slack_client.rb`        | API client      |
| `app/models/slack/workspace.rb`                    | Workspace model |
| `app/models/slack/channel_link.rb`                 | Channel links   |
| `app/services/brands/strategy_slack_update.rb`     | Strategy posts  |
| `app/services/weekly_reports/sender.rb`            | Report posts    |
| `app/controllers/api/webhooks/slack_controller.rb` | Webhooks        |
