This is the official Slack integration for Worknice which can be added to any organisation from the app directory.
Features:
- Sync Slack users into Worknice.
- Post daily notifications to Slack about events on the Worknice shared calendar (birthdays, work anniversaries and leave periods).
- Post notifications to Slack when new people start.
- Lookup a Worknice person in Slack using a
/whois
slash command in Slack. - See who is on leave using a
/whosaway
slash command in Slack.
You can deploy your own instance of this app to Vercel by following the steps below:
-
Fork this repository.
-
Slack configuration:
-
Create a new Slack app.
-
Add a
https://«your-app.com»/auth-callback
OAUth redirect URL. -
Add a
/whois
slash command that points tohttps://«your-app.com»/slack-slash-commands
. -
Add a
/whosaway
slash command that points tohttps://«your-app.com»/slack-slash-commands
.
-
-
Worknice configuration:
-
Create a new "Integration App" in Worknice.
-
Configure the app with the following details:
createIntegration: https://«your-app.com»/worknice-webhooks/create-integration getAuthorizationUrl: https://«your-app.com»/worknice-webhooks/get-authorization-url getReconfigurationUrl: https://«your-app.com»/worknice-webhooks/get-reconfiguration-url triggerIntegrationSync: https://«your-app.com»/worknice-webhooks/trigger-integration-sync
-
-
Vercel configuration:
-
Create a new project in Vercel.
-
Add an Upstash KV (Redis) database to your account.
-
Connect the Upstash KV database to your Vercel project. This should set the
REDIS_REST_API_TOKEN
andREDIS_REST_API_URL
environment variables. -
Set the remaining environment variables:
# The URL where your instance is hosted. BASE_URL=https://«your-app.com» # A secret to secure the Vercel cron jobs (see https://vercel.com/docs/cron-jobs/manage-cron-jobs#securing-cron-jobs). CRON_SECRET=xxx # Client ID for the Slack app. SLACK_CLIENT_ID=xxx # Client secret for the Slack app. SLACK_CLIENT_SECRET=xxx # URL where Slack will redirect after authentication (must match the Redirect URI configuration in Slack). SLACK_REDIRECT_URI=https://«your-app.com»/auth-callback # The signing secret to secure requests from Slack. SLACK_SIGNING_SECRET=xxx
-
Redeploy the project so that the environment variables take effect.
-
-
Install dependencies:
pnpm install
-
Start the background services (Redis instance):
pnpm activate
-
Start the Next.js app in dev mode:
pnpm dev
The app will be available at http://localhost:6100.
-
Tear down the background services (Redis instance):
pnpm deactivate
-
Test the TypeScript types:
pnpm test:types
-
Connect to the local Redis instance using the
redis-cli
. On macOS, you can install it using Homebrew:brew install redis
You can connect like this:
redis-cli -p 6101 PING
You can learn more about how to build Worknice integrations like this one on the Worknice Developer Portal.