Gif finder application for slack which uses Giphy API.
Report Bug
·
Request Feature
Table of Contents
This is a project to select a gif in an easier way to send it from slack. A slack message from my friend Grace was the initial motivation for this project, thanks to her. Before this project you had two options, you can use Giphy's integration which gives you a random gif and you can shuffle or you can go to the website directly and copy the gif directly from there. Both metods did not seem perfect for the ease of use. So decided to write an application to solve this issue. Currently it is still not the perfect solution but planning to try different approaches. Current solution is giving you first 10 gifs from the search of Giphy API.
There is also a possibility to extend (create new one like this) this repository to collect different applications in one place as open source.
Since this is a platform dependent project which depends on slack, we need to set some configurations on their website to use this project.
- You need to create a new application from here.
- Go to your application and from
Event Subscriptions
tab setEnable Events
asOn
. - At the same page, open
Subscribe to bot events
and add the followings:- app_mention
- message.channels
- message.groups
- message.im
- message.mpim
- Come to the
Slash Commands
tab and pressCreate New Command
button. - Write
/find-gif
as command and set a short description likefinds gifs
. - Come to the
Interactivity & Shortcuts
tab and pressCreate New Shortcut
button. - Select
Global
for it to be displayed when shortcut button is used. - Write its name as
search gifs
as shortcut name and set a short description likesearch best gifs to send
, then add theCallback ID
assearch_shortcut
and press theCreate
button.
- Make sure you have python3.6 or higher installed.
- Run the following command to create a virtual environment:
python3 -m virtualenv venv
- Run the following commands to activate virtual environment and install
requirements.txt
:
source venv/bin/activate
pip install -r requirements.txt
- For
SLACK_SIGNING_SECRET
go to theBasic Information
tab from your application's page. - Scroll down to
App Credentials
and copySigning Secret
for theSLACK_SIGNING_SECRET
. - For
SLACK_APP_TOKEN
continue scrolling down toApp-Level Tokens
and pressGenerate Token and Scopes
button, name it as you wish and addconnections:write
scope, then you can create the token. Copy that token and assign toSLACK_APP_TOKEN
in the.env
file. - For
SLACK_BOT_TOKEN
come toInstall App
tab and see theBot User OAuth Token
, copy it and assign it toSLACK_BOT_TOKEN
. - For
GIPHY_KEY
go to this link and press the create account since you need to have an account to get an API Key. - After creating the account press
Create an App
button,select API
and create your app. - You can copy the token and assign to
GIPHY_KEY
.
- First make sure that virtual environment (venv) is active, if not activate is with the following command:
source venv/bin/activate
- After you are sure that venv is active, run the below command to start the application:
python app.py
First of all, make sure application is running.
Go to your own chat or go to the chat with your application and run command /find-gif <write your search query here without '<','>' symbols>
. Application will print 10 gifs with that search query numbered from 1 to 10 and will ask you which one you want to send. After you pick the number, application will ask which channel you want to send. Be careful, if you do not invite the application to that channel before, application cannot send the gif. So first go to that channel and invite your application with /invite <your application name>
. After that when you select the channel, it will send the selected gif directly.
Press the Attachments & shortcuts
button or write /search
and slack will suggest you the search gifs
shortcut. When you click, it will open a modal, write what you want to search as a gif and select where you would like to send it. In the next page, 10 gifs will be shown that you can scroll down and there will be a send button under each gif so that you can send it easily.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Thanks!
- Fork the Project
- If there is no issue about that feature/fix, first create an issue
- Create your branch from that issue and checkout (
git checkout -b <issue number>-<issue name spaces replaced with dash>
) - Commit your changes with meaningfull start like "Feat:" / "Fix:" / "Refactor:" ... (
git commit -m 'Feat: Add some AmazingFeature'
) - Push to the Branch (
git push origin <issue number>-<issue name spaces replaced with dash>
) - Open a Pull Request
P.S. if you want to contribute README.md or docs, you can use grip
it is already included to the requirements.txt file. You just need to run the command grip
and you can preview if from your localhost.
This project is distributed under the Apache 2.0 License. See LICENSE for more information.
If we see the requirement for a fast paced discussion environment, we can create a slack or discord channel. At the point please create an issue about it or if the issue is already there please upvote with an emoji. Until then, you can reach me from below email address.
Kaya Kapagan - kayakapagan@sabanciuniv.edu
Project Link: https://github.com/kayakapagan/slack-gif-application
Below, you can find some resources that helped during the development, and may help you too.
- Slack API
- Bolt Python Documentation
- How to build a simple Slack bot using the Bolt framework for Python by
PyBites
- Giphy API Documentation
- README Template
Please don't forget to give a ⭐️ if you like this project! Thanks again!