Parapix GIF Picker

Setup Guide

Get Your Bot Running

Follow these steps to configure your Parapix GIF Picker Slack bot.

Step 1
Create a New Slack App

First, you need to create a new Slack app. Go to the Slack API dashboard and click 'Create New App'. Choose to create an app 'From scratch'. Name it 'Parapix GIF Picker' and select your workspace.

Go to Slack API Dashboard
Step 2
Add Permissions (Scopes)

Your bot needs permission to perform actions. Navigate to 'OAuth & Permissions' in the sidebar. Scroll down to 'Scopes' and add the following Bot Token Scopes:

commandschat:writefiles:read

• `commands`: To add the /gifpicker slash command. • `chat:write`: To post the selected GIF into channels. • `files:read`: To index GIFs from the #parapixgifs channel in the future.

Step 3
Create a Slash Command

Now, let's create the `/gifpicker` command. Go to 'Slash Commands' and click 'Create New Command'.

Command: /gifpicker
Request URL: https://<your-app-url>/api/slack/command
Short Description: Opens the Parapix GIF picker.

Replace `<your-app-url>` with the public URL of this deployed application.

Step 4
Enable Interactivity

To handle button clicks in the GIF picker modal, you need to enable interactivity. Go to 'Interactivity & Shortcuts'. Toggle it on and set the Request URL to:

Request URL: https://<your-app-url>/api/slack/interaction

Again, replace `<your-app-url>` with your app's public URL.

Step 5
Install App and Get Tokens

Install your app to your workspace by going to 'Basic Information' and clicking 'Install to Workspace'. After installing, go back to 'OAuth & Permissions' to find your 'Bot User OAuth Token'. On the 'Basic Information' page, find your 'Signing Secret' under App Credentials.

You will need to set SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET as environment variables in your hosting service. For local development, you can add them to the .env file.

Step 6
Final Steps

Make sure your bot is invited to any channels where you want to use it. This app now verifies request signatures from Slack using your 'Signing Secret'. This is a critical security measure to ensure all requests are genuine.

A Note on Functionality

When you select a GIF from the modal, this bot will post it directly into the channel or conversation where you used the /gifpicker command. Due to Slack API limitations, it's not possible for a slash command to insert content directly into your message composition box. This implementation provides the next best experience by posting the GIF for you.