To install this project using Heroku, you will need:
- A Heroku account, available for free from Heroku.com
- A Heroku CLI, available for free from Heroku.com
- A GitHub account, available for free from GitHub.com
Here's how to start:
-
Create a copy of this project to manipulate
-
Log in to your GitHub account. Go to the Github repository of this project click Fork in the top-right corner to create a copy of this project that you can control and manipulate
-
Deploy your project copy to Heroku
$ heroku login
$ heroku create
$ git push heroku master
-
Connect your project to your Mattermost account for slash commands
-
Log in to your Mattermost account. Click the three dot menu at the top of the left-hand side and go to Integrations > Slash Commands
-
Under Add a new command, enter
gif
into Command Trigger Word -
Paste your Heroku domain into Callback URLs to the beginning and
/new_post
to the end so it looks similar tohttp://<your-heroku-domain>/new_post
-
Select
POST
method -
(optional) Choose a username and icon url (more details here)
-
(optional) Check the autocomplete checkbox, add
[KEYWORD]
as the hint,Returns a GIF from Giphy based on the keyword
as the description andGet a GIF from Giphy
as the descriptive label -
Copy the Token from your newly created slash command that appears under the Existing commands section
-
Configure your heroku app with the new token
$ heroku config:set MATTERMOST_GIPHY_TOKEN=xxxxx
That's it! Waiting a few minutes for the Heroku process to restart you should be able to type gif: hello
or /gif hello
into any channel and see a GIF from Giphy's translate service.
If you'd like to use this integration in a production envrionment, it is strongly recommended that you get a production Giphy API key from here. Once you have that you can configure the integration to use it:
- Go to your Heroku Dashboard and click on your app
- Click the Settings tab. Under the Config Variables section, click Reveal Config Vars
- For KEY type in
GIPHY_API_KEY
and for VALUE paste in your Giphy API key, then click Add - Wait a minute for the Heroku process to restart