Parapix GIF Picker
Get Your Bot Running
Follow these steps to configure your Parapix GIF Picker Slack bot.
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 →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.
Now, let's create the `/gifpicker` command. Go to 'Slash Commands' and click 'Create New Command'.
/gifpickerhttps://<your-app-url>/api/slack/commandOpens the Parapix GIF picker.Replace `<your-app-url>` with the public URL of this deployed application.
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:
https://<your-app-url>/api/slack/interactionAgain, replace `<your-app-url>` with your app's public URL.
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.
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.
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.