Slack Auto-Poker is a Node.js application that connects your Shortcut (formerly Clubhouse) stories with your Slack workspace. It listens for story updates with specific labels and then posts a message to Slack containing the story's name, ID, and a link to the published poker session.
- Node.js
- A Shortcut account with API access
- A Slack App with Socket Mode enabled
- In Shortcut, attach a label (e.g., "poker") to the story you want to work with. This triggers the webhook and sends a StoryPlan message to the designated Slack channel.
- In the Slack channel, find the StoryPlan message containing the Shortcut story's details (name, URL, and ID).
- The created StoryPlan message's link will be automatically attached to the current Shortcut story as an external link.
-
Clone this repository to your local machine.
git clone https://github.com/yourusername/slack-auto-poker.git cd slack-auto-poker
-
Install the dependencies.
npm install
-
Copy the
.env-samplefile to a new file named.envand fill in the required environment variables.cp .env-sample .env
SLACK_BOT_TOKEN: Your Slack bot token (starts withxoxb-)SLACK_APP_TOKEN: Your Slack app token (starts withxapp-)SHORTCUT_TOKEN: Your Shortcut API tokenSLACK_WEBHOOK_URL: Your Slack Incoming Webhook URL
-
Run the application.
npm start
The application will start and listen for updates from Shortcut.
-
Visit the Slack API website and sign in with your Slack account.
-
Click on the "Create New App" button and choose "From scratch." Give your app a name and select the desired workspace for development.
-
Navigate to the "OAuth & Permissions" page under the "Features" section in the sidebar. Scroll down to the "Scopes" section and add the following bot token scopes:
workflow.steps:execute,commands, andchat:write. Save your changes. -
Click "Install App" in the sidebar and then click "Install App to Workspace." Authorize the app and copy the "Bot User OAuth Token" that appears on the "OAuth & Permissions" page. You'll need this token as the
SLACK_BOT_TOKENenvironment variable. -
Navigate to the "Socket Mode" page under the "Settings" section in the sidebar. Enable Socket Mode and generate an "App-Level Token" with the
connections:writescope. Save this token as theSLACK_APP_TOKENenvironment variable. -
In the
webhook.jsfile, replace the placeholder value for theSLACK_WEBHOOK_URLenvironment variable with your own webhook URL obtained from your Slack workspace. -
Now that the Slack app is set up, you can create a new Workflow in your Slack workspace using the Workflow Builder.
-
In your Slack workspace, click the "Shortcuts" button (lightning bolt icon) next to the message input field. Select "Create a workflow" and give your workflow a name.
-
In the Workflow Builder, click the "+" button to add a new step. Choose "Add a step from an app" and search for the StoryPlan app. Select the custom step from the StoryPlan app, which should be named "connect_with_poker."
-
Configure the custom step with the required inputs and outputs, as well as any additional steps you'd like to include in your workflow.
-
Save and publish your workflow. Your Slack app is now ready to use!
Once the Slack app and the custom step are integrated into your workflow, the app will be able to automatically update Shortcut cards with poker information when the workflow is executed.
Don't forget to update your .env file with the SLACK_BOT_TOKEN, SLACK_APP_TOKEN, and SLACK_WEBHOOK_URL environment variables.
-
Deploy the application to a server or hosting provider that supports Node.js, and take note of the webhook URL.
-
In the Shortcut Integrations settings, add a new Webhook Integration and set the webhook URL to the one provided by your deployed application.
-
Configure the webhook to listen for specific events related to stories, particularly when a label is added to a story. Ensure the webhook triggers when one of the desired labels (e.g., "poker" or "poker-2") is added.
-
Save the webhook settings in Shortcut.
Now, when a story is updated with the specified label(s) in Shortcut, the webhook will send the story information to the Slack Auto-Poker app, which will post a message to your Slack workspace with the relevant details.