Slack Integration

Connect Who's OOO to Slack for leave request approvals, weekly digests, personal notifications, and automatic status updates

Overview

The Slack integration adds four capabilities:

  • Approval channel: new leave requests are posted to a shared channel with Approve / Reject buttons. Managers act directly from Slack.
  • Weekly digest: once a week, at a day and time you choose, a summary is posted: who's out this week, birthdays, and work anniversaries.
  • Private DMs: users receive a personal Slack message when their leave request is approved or rejected from Slack, or approved automatically.
  • Status sync: while someone is on approved leave, their Slack status shows it (e.g. 🌴 "Vacation until Apr 18") and is cleared when they're back. Requires a paid Slack workspace.

Create a Slack app

  1. Go to api.slack.com/apps and click Create New App → From scratch.
  2. Name the app (e.g. "Who's OOO") and select your workspace.
  3. Under OAuth & Permissions → Scopes → Bot Token Scopes, add chat:write.
  4. Click Install to Workspace and authorize.
  5. Copy the Bot User OAuth Token (starts with xoxb-).

Environment variables

Add these variables to app/.env.local:

SLACK_DSN=slack://TOKEN@default?channel=CHANNEL
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_AR_APPROVE_CHANNEL_ID=C0123APPROVAL
SLACK_AR_HR_DIGEST_CHANNEL_ID=C0123DIGEST
Variable Where to find it
SLACK_DSN Bot token from the previous step. Replace TOKEN with the xoxb- value.
SLACK_SIGNING_SECRET Basic Information → App Credentials → Signing Secret
SLACK_AR_APPROVE_CHANNEL_ID Right-click the approval channel in Slack → View channel details → copy the Channel ID at the bottom.
SLACK_AR_HR_DIGEST_CHANNEL_ID Same steps for the digest channel.

Tip: Channel IDs look like C04ABCD1234. Don't use the channel name — it won't work.

Every request Slack sends to the app is checked against SLACK_SIGNING_SECRET, so only your Slack app can call it. While the secret is empty, every request is rejected.

Enable interactivity

For the Approve / Reject buttons to work, Slack needs to send button clicks back to your app.

  1. In your Slack App settings, go to Interactivity & Shortcuts.
  2. Toggle Interactivity to On.
  3. Set the Request URL to:
    https://your-domain.com/api/slack/interactive-endpoint
    
  4. Click Save Changes.

When a manager clicks a button, the app verifies the Slack signature, updates the leave request, and edits the original Slack message to show the outcome.

For local development, use ngrok to expose your local server:

ngrok http 80

Then set the Request URL to the ngrok HTTPS URL, e.g.:

https://abc123.ngrok-free.app/api/slack/interactive-endpoint

Warning: The ngrok URL changes every time you restart it (on the free plan). Update the Slack Request URL accordingly.

Invite the bot to channels

The bot must be a member of both the approval and digest channels to post messages.

In each channel, type:

/invite @Who's OOO

Or open the channel settings and add the app under Integrations → Apps.

Connect individual users

Each user can link their Slack account to receive personal DMs about their leave requests.

  1. In the app, go to Profile Settings (in the Account section of the sidebar).
  2. On the Connected Services card, click Configure next to Slack.
  3. Enter your Slack Member ID and save.

To find your Slack Member ID: click your profile picture in Slack → Profile → click the three-dot menu → Copy Member ID.

DMs are sent when a request is approved or rejected with the buttons in the approval channel, and when a request is auto-approved. Approvals and rejections made in the web app are sent by email.

Admin status check

Admins can verify which users have connected their Slack accounts.

Go to My Organization — each user's row shows a Slack status indicator. A green icon means the user has linked their Slack Member ID; grey means they haven't.

Weekly digest

The weekly digest posts to the digest channel with:

  • Who's out this week (approved leave and public holidays)
  • Birthdays
  • Work anniversaries

By default it runs every Monday at 08:15 UTC. Admins change the day, time, and timezone under Settings → App Settings → Weekly Digest Schedule. Changes are picked up on the next scheduler tick, without a restart.

The digest runs on its own scheduler transport, so the worker service must be running (it is part of both Docker stacks). Without Docker, run:

php bin/console messenger:consume scheduler_default scheduler_weekly_digest async

You can trigger it manually for testing:

# Development stack
docker exec -it app_ooo_php php bin/console slack:weekly_digest

# Production stack
docker compose -f docker-compose.prod.yml exec php bin/console slack:weekly_digest

Tip: If nobody is out and there are no birthdays or anniversaries, the digest posts a short "Good news!" message instead.

Slack status sync

While a user is on approved leave, the app sets their Slack status to the leave type's emoji and a text like "Vacation until Apr 18", and clears it when the leave ends or is cancelled.

Warning: Status sync needs a paid Slack workspace. Free plans don't allow an app to set another user's status.

The sync job runs every 20 minutes. Each leave request carries an internal sync flag, so a status is never set twice and the job catches up on its own after downtime.

Admin setup

  1. Add these variables to app/.env.local:

    SLACK_CLIENT_ID="your-slack-app-client-id"
    SLACK_CLIENT_SECRET="your-slack-app-client-secret"
    SLACK_TOKEN_ENCRYPTION_KEY="base64-encoded-32-byte-key"
    

    Generate the encryption key with:

    php -r "echo base64_encode(sodium_crypto_secretbox_keygen());"
    

    The key encrypts the admin's OAuth token at rest. Keep it secret. If you change it, you have to authorize status sync again.

  2. In the Slack app settings, add this OAuth redirect URL:

    https://your-domain.com/app/settings/slack-status-sync/oauth/callback
    
  3. Under OAuth & Permissions → User Token Scopes, add users.profile:write.

  4. In Who's OOO, open Settings → App Settings and turn on Enable Slack status auto-sync.

  5. Open Settings → Integrations and click Authorize status sync on the Status Sync card. Slack asks you to grant permission. The person doing this must be an Owner or Admin of the Slack workspace.

  6. Once authorized, the card shows the sync as active.

Warning: Adding a scope means reinstalling the Slack app in your workspace. That issues a new Bot User OAuth Token, so update SLACK_DSN afterwards.

Each user needs their Slack Member ID in their profile (see Connect individual users) for their status to be set.

Leave type emojis

Each leave type can have its own Slack emoji, such as :palm_tree: or :face_with_thermometer:. Set it in the Slack status emoji field when editing a leave type. Leave it blank and you get :calendar:.

User opt-out

Users can turn status sync off for their own account: Profile Settings → Connected Services → Slack → Configure, then untick Auto-set my Slack status when I'm on leave. The option shows up as soon as an admin turns on Enable Slack status auto-sync in App Settings, even before anyone has authorized status sync. Statuses only change once it is authorized.

Revoking access

An admin can revoke the authorization at any time with Revoke authorization on the Status Sync card under Settings → Integrations. That turns the feature off for everyone at once. If the admin's token stops working (for example, the person who authorized it was removed from Slack), the app notices and turns the feature off by itself.