Skip to content

esethna/mattermost-integration-giphy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Giphy Integration Service for Mattermost

Mattermost community members are invited to fork this repo to create new integrations. To have your integration referenced on http://www.mattermost.org/webhooks/, please mail [email protected] or tweet to @MattermostHQ.

Powered by Giphy.

Requirements

To run this integration you need:

  1. A web server supporting Python 2.7 or a compatible version to run this software (optionally, you could use a service provider like Heroku - see instructions below)
  2. A Mattermost account where outgoing webhooks are enabled

Regarding 1. there are many options for web servers you can use, below we provide instructions for both Heroku and a general Linux/Ubuntu server to get something running:

Heroku-based Install

To install this project using Heroku, you will need:

  1. A Heroku account, available for free from Heroku.com
  2. A GitHub account, available for free from GitHub.com

Here's how to start:

  1. Create a copy of this project to manipulate

  2. From the Github repository of this project click Fork in the top-right corner to create a copy of this project that you control and can update as you like.

  3. Deploy your project copy to Heroku

  4. Go to your Heroku Dashboard and click + in the top-right corner then New App. Give your app a unqiue name (like mattermost-giphy-[YOUR_GITHUB_USERNAME]), select your region and click Create App.

  5. On the Deploy screen, select GitHub at the top, then click Connect to GitHub to authorize Herkou to access your GitHub account

  6. Select your account and search for your repo name by typing mattermost-integration-giphy in the repo-name field, then click Search and then the Connect button next to your repository

  7. Scroll to the bottom of the new page and under the Manual Deploy section click Deploy Branch, making sure the master branch is selected

  8. Go to Settings > Domains > Settings and copy the URL below Heroku Domain (we'll refer to this as http://<your-heroku-domain>/ and we'll need it in the next step)

  9. Leave your Heroku interface open as we'll come back to it to finish the setup

  10. Connect your project to your Mattermost account for outgoing webhooks

  11. Log in to your Mattermost account, and from three dot icon at the top of the left-hand menu go to Account Settings > Integrations > Outgoing Webhooks > Edit

  12. Under Add a new outgoing webhook, leave the Channel unselected and enter /gif into Trigger Words

  13. Paste your Heroku Domain into Callback URLs, making sure to add http:// to the beginning and /new_post to the end so it looks similar to http://myapp.heroku.com/new_post and click Add

  14. Copy and highlight the Token from you newly created webhook that should appear in the Existing outgoing webhooks section below

  15. Back on your Heroku dashboard, under Settings -> Reveal Config Vars, add MATTERMOST_TOKEN as the KEY and paste in the token you copied as the VALUE, and click Add

That's it! After waiting a minute for the Heroku process to restart you should be able to type /gif hello into any channel and see a GIF from Gihpy's translate service.

Linux/Ubuntu 14.04 Web Server Install

The following procedure shows how to install this project on a Linux web server running Ubuntu 14.04. The following instructions work behind a firewall so long as the web server has access to your GitLab and Mattermost instances.

To install this project using a Linux-based web server, you will need:

  1. A Linux/Ubuntu 14.04 web server supporting Python 2.7 or a compatible version. Other compatible operating systems and Python versions should also work.

Here's how to start:

  1. Set up this project to run on your web server

  2. Set up a Linux Ubuntu 14.04 server either on your own machine or on a hosted service, like AWS.

  3. SSH into the machine, or just open your terminal if you're installing locally.

  4. Confirm Python 2.7 or a compatible version is installed by running:

    • python --version
    • If it's not installed you can find it here
  5. Install pip and other essentials

    • sudo apt-get install python-pip python-dev build-essential
  6. Clone this GitHub repo with

    • git clone https://github.com/mattermost/mattermost-integration-giphy.git
    • cd mattermost-integration-giphy
  7. Install integration requirements

    • sudo pip install -r requirements.txt
  8. Set up your Mattermost outgoing webhooks

  9. Log in to your Mattermost account, and from three dot icon at the top of the left-hand menu go to Account Settings > Integrations > Outgoing Webhooks > Edit

  10. Under Add a new outgoing webhook, leave the Channel unselected and enter /gif into Trigger Words

  11. Paste your Heroku Domain into Callback URLs, making sure to add http:// to the beginning and /new_post to the end so it looks similar to http://myapp.heroku.com/new_post and click Add

  12. Copy and highlight the Token from you newly created webhook that should appear in the Existing outgoing webhooks section below

  13. Run the server with the correct configuration

  14. Back on SSH or your terminal, add the following lines to your ~/.bash_profile

    • export MATTERMOST_TOKEN=<your-token-here> This is the token you copied in the last section
    • export PORT=<your-port-number> The port number you want the integration to listen on (defaults to 5000)
  15. Source your bash profile

    • source ~/.bash_profile
  16. Run the server

    • python server.py

That's it! You should be able to type /gif hello into any channel and see a GIF from Gihpy's translate service.

Production Setups

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:

On Heroku
  1. Go to your Heroku Dashboard and click on your app
  2. Go to Settings -> Config Variables and click Reveal Config Vars
  3. For KEY type in GIPHY_API_KEY and for VALUE paste in your Giphy API key, then click Add
  4. Wait a minute for the Heroku process to restart
On Linux/Ubuntu 14.04 Web Server
  1. Stop the process currently running the integration
  2. Add the following lines to your ~/.bash_profile
    • export GIPHY_API_KEY=<your-api-key-here> With your Giphy API key
  3. Source your bash profile
    • source ~/.bash_profile
  4. Run the server again
    • python server.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%