Git Product home page Git Product logo

mattermost-integration-giphy's Introduction

Giphy Integration Service for Mattermost

This integrations service is used to enable an external search engine (Giphy) to be queried based on commands issued in a Mattermost channel using Mattermost outgoing webhooks.

Once installed, users can type gif: keyword to send a query to the Giphy search engine and return with a post containing one non-deterministic search result from the Giphy database of animated GIF files matching keyword. The animation will appear below in the posted message.

Powered by Giphy.

Project Goal

The goal of this project is to provide a fully-functional template on which the Mattermost community can create their own integration services. Community members are invited to fork this repo to add improvements and to create new integrations.

To have your work included on the Mattermost integrations page, please mail [email protected] or tweet to @MattermostHQ.

Requirements

To run this integration you need:

  1. A web server supporting Python 2.7 or compatible versions.
  2. A Mattermost account where outgoing webhooks are enabled

Many web server options will work, below we provide instructions for Heroku and a general Linux/Ubuntu server.

Heroku-based Install

Here

Linux/Ubuntu 14.04 Web Server Install

Here

Docker install

Here

mattermost-integration-giphy's People

Contributors

ddrum001 avatar dependabot[bot] avatar devtechi avatar devvmh avatar it33 avatar juburin avatar jwilander avatar lesuisse avatar lujeni avatar mattsch avatar mjhuber avatar monsieurp avatar pichouk avatar ramnes avatar sylvainemery avatar trubesv avatar ultrabug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mattermost-integration-giphy's Issues

Command with a trigger of 'giphy' returned response 404 Not Found

I have tried all permutations of configuration available and cannot get this to work.

I've seen people say that adding the port to the callback url on the slash command helps, but if I do, all it does is timeout.

I've setup all the information on the bash_profile, key, port (5000), host (0.0.0.0), but nothing.

Any help would be greatly appreciated.

Integration not working

Hi,

I followed the Linux instructions, but when I try to use the slach command in the chat, I get "Command with a trigger of 'gif' failed".
When I check the mattermost logs, I see this :
{"level":"error","ts":1535273730.144273,"caller":"web/context.go:60","msg":"Command with a trigger of 'gif' failed","path":"/api/v4/commands/execute","request_id":"btuojx5tttnntyed7ifrwskdjc","ip_addr":"192.168.1.21","user_id":"s56ob3yxrpf1ucygnt6s6ckf3y","method":"POST","err_where":"command","http_code":500,"err_details":"Post http://192.168.1.4:8080/new_post: address forbidden"}

192.168.1.21 is the client on which I use the webclient
192.168.1.4 is the server hosting everything.
I tried also with port 5000 and 8067 which I configured each time in the ~/.bash_profile and in the slach command configuration.

When I enter the URL http://192.168.1.4:8080/new_post manually in a browser, I see output in the integration server :
[2018-08-26 10:52:38,697] [INFO] 192.168.1.21 - - [26/Aug/2018 10:52:38] "GET /new_post HTTP/1.1" 405 -

I think I'm missing something, but I can't figure out what.

Any help would be appreciated.

The server is on Debian 9 and Python is 2.7.13

Issue when running run.py

I am following the instructions (https://github.com/numberly/mattermost-integration-giphy/blob/master/LINUX.md) but get the following error when I run "python run.py"

Running Ubuntu 16.04.3 LTS

Traceback (most recent call last):
File "run.py", line 20, in
app.run(host=str(host), port=int(port))
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 772, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.13-py2.7.egg/werkzeug/serving.py", line 799, in run_simple
inner()
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.13-py2.7.egg/werkzeug/serving.py", line 759, in inner
fd=fd)
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.13-py2.7.egg/werkzeug/serving.py", line 651, in make_server
passthrough_errors, ssl_context, fd=fd)
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.13-py2.7.egg/werkzeug/serving.py", line 562, in init
HTTPServer.init(self, (host, int(port)), handler)
File "/usr/lib/python2.7/SocketServer.py", line 417, in init
self.server_bind()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.7/SocketServer.py", line 431, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address

Can't run server

Hi,

when i run python run.py i receive the following error:

Traceback (most recent call last):
File "run.py", line 20, in
app.run(host=str(host), port=int(port))
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 772, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.11.11-py2.7.egg/werkzeug/serving.py", line 694, in run_simple
inner()
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.11.11-py2.7.egg/werkzeug/serving.py", line 656, in inner
fd=fd)
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.11.11-py2.7.egg/werkzeug/serving.py", line 550, in make_server
passthrough_errors, ssl_context, fd=fd)
File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.11.11-py2.7.egg/werkzeug/serving.py", line 464, in init
HTTPServer.init(self, (host, int(port)), handler)
File "/usr/lib/python2.7/SocketServer.py", line 417, in init
self.server_bind()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.7/SocketServer.py", line 431, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)

I tried different host port configurations but nothing seems to work. Any suggestions?

Edit
OS: Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-47-generic x86_64)
Python: 2.7.12

If you need more information let me know

Thanks in advance

Error during docker build

unable to execute 'gcc': No such file or directory
==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
Retrying the build without the C extension now.

==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Plain-Python installation succeeded.
==========================================================================

Adding the following to the Dockerfile fixed the error:
RUN apk add build-base

I can submit a pull request if you like.

AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

I'm unable to install this module, it seems to fail the installation of the requests package with the error AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'.

  • Debian Jessie, up-to-date.
  • Python 2.7.9

Bumping the version needed seems to make the installation working: it installs requests==2.10.0 instead of 2.2.1.

Docker problem

I'm trying to run it with docker, but it doesn't work:

➜ curl -v 127.0.0.1:5000/ 
* About to connect() to 127.0.0.1 port 5000 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:5000
> Accept: */*
> 
------- it just hangs there --------
^C

The same with curl -v 127.0.0.1:5000/new_post

But it fails when I try different port, so it obviously somehow runs.

I have this in mattermost log:

2017-05-26_10:57:15.47724 [2017/05/26 12:57:15 CEST] [EROR] /api/v3/teams/xxxxx/commands/execute:command code=500 rid=xxxxx uid=xxxxx ip=x.x.x.x Command with a trigger of 'giphy' failed [details: Post http://127.0.0.1:5000/new_post: read tcp 127.0.0.1:50494->127.0.0.1:5000: read: connection reset by peer]

Some other relevant info:

➜ docker ps 
CONTAINER ID        IMAGE                          COMMAND             CREATED             STATUS              PORTS                    NAMES
d55df86848cd        mattermost-integration-giphy   "python run.py"     14 minutes ago      Up 14 minutes       0.0.0.0:5000->5000/tcp   mattermost-giphy
➜ docker logs d55df86848cd
[2017-05-26 10:52:49,061] [INFO]  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

405 Not allowed

Hi all,

I've installed Mattermost 3.1.0 and wanted the giphy integration, but I'm struggled with a 405 Not Allowed :(

[2016-06-28 17:13:44,794] [INFO] 127.0.0.1 - - [28/Jun/2016 17:13:44] "POST / HTTP/1.1" 405 -

If someone could lead me to a solution.

I'm on Ubuntu Trusty 14.04
Request 2.10.0

Ubuntu 14.04 web server install

Hi,

I've followed the instructions down as far as Install integration requirements but am getting the following errors when running sudo python xxxx.py install:

python: can't open file 'setup.py': [Errno 2] No such file or directory

There is no setup.py file, there is a server.py file in the repo so I ran the command using this in case this was a typo but getting the following error:

Traceback (most recent call last):
File "server.py", line 6, in
from flask import Flask

Mattermost v4

Anyone having an issue with giphy after upgrading to Mattermost 4.x ?

Giphys work in the public and private channels, but doesn't work for direct messages.

Gives the message "We couldn't find the existing team." in the UI, and logs the following in the console:

2017/07/27 09:09:34 EDT] [EROR] /api/v4/commands/execute:SqlTeamStore.Get code=404 rid=xxxxxxx uid=xxxxxxxxx ip=0.0.0.0, 0.0.0.0 We couldn't find the existing team [details: id=]

[ERROR] unable to handle new post :: tuple index out of range

This error shows up in both the app.py stdout as well as a post by the bot on mattermost: "tuple index out of range". It seems more likely to be a python or dependency error so I apologize for seeking help here--I just can't figure out what's causing it.

Add python-setuptools to install guide

sudo python setup.py install
fails because setuptools is missing. (Ubuntu 18.04)
Consider adding sudo apt-get install python-setuptools to install-guide for a complete guide.

Heroku App - 503 Service error

For some reason using Heroku the service doesn't appear to be responding. I followed the docs. Any insight as to why I'm getting a 503 when testing the POST?

Note, I've changed the URLs so not as to end up with crazy cost from dynos

wget --post-data 'test' http://mymattermostinstall.herokuapp.com
--2016-03-25 14:33:24--  http://mymattermostinstall.herokuapp.com/
Resolving mymattermostinstall.herokuapp.com... 50.16.232.151
Connecting to mymattermostinstall.herokuapp.com|50.16.232.151|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2016-03-25 14:33:24 ERROR 503: Service Unavailable.

Command with a trigger of 'giphy' failed

When trying to test, I get the following error: Command with a trigger of 'giphy' failed

Error logs:

[2017/12/14 10:29:16 EST] [EROR] /api/v4/commands/execute:command code=500 rid=mhpqfqmih3fpdgqdz4o uid=hhpqaigchsom466gm6o ip=xxx.xxx.xxx.xxx Command with a trigger of 'giphy' failed [details: Post http://chat.domian.org:5000/new_post: dial tcp xxx.xxx.xxx.xxx:5000: i/o timeout]

I've run 'python run.py', and when I visit URL:5000 I get "OK" displayed.

Two questions:

  1. What am I doing wrong here
  2. How can I get run.py to run at startup, it's not working.

Error when running docker container

Hey!

Get this error when I want to start the docker container:
Andy Ideas?

My Docker run command looks ,ike this:
docker run -d -e autostart=true --restart always --name mattermost-giphy -p 5000:5000 -e MATTERMOST_GIPHY_TOKEN=7hwb9c7hapb8dexsryciexoh1a -e MATTERMOST_GIPHY_HOST=IP-ADRESS -e MATTERMOST_GIPHY_PORT=5000 -e GIPHY_API_KEY=dc6zaTOxFJmzC mattermost-integration-giphy

Traceback (most recent call last): File "run.py", line 20, in <module> app.run(host=str(host), port=int(port)) File "/usr/local/lib/python2.7/site-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 772, in run run_simple(host, port, self, **options) File "/usr/local/lib/python2.7/site-packages/Werkzeug-0.12.2-py2.7.egg/werkzeug/serving.py", line 739, in run_simple inner() File "/usr/local/lib/python2.7/site-packages/Werkzeug-0.12.2-py2.7.egg/werkzeug/serving.py", line 699, in inner fd=fd) File "/usr/local/lib/python2.7/site-packages/Werkzeug-0.12.2-py2.7.egg/werkzeug/serving.py", line 593, in make_server passthrough_errors, ssl_context, fd=fd) File "/usr/local/lib/python2.7/site-packages/Werkzeug-0.12.2-py2.7.egg/werkzeug/serving.py", line 504, in __init__ HTTPServer.__init__(self, (host, int(port)), handler) File "/usr/local/lib/python2.7/SocketServer.py", line 417, in __init__ self.server_bind() File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind SocketServer.TCPServer.server_bind(self) File "/usr/local/lib/python2.7/SocketServer.py", line 431, in server_bind self.socket.bind(self.server_address) File "/usr/local/lib/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 99] Address not available

Suggestion: Let user select gif from a few samples

It would be really cool if there could be another command that would execute the search query, and privately show the calling user maybe 3 gifs generated by the giphy search. Users would then be able to use a follow up command to select one of the images and then that is posted in the chat room for everybody to see.

e.g workflow

/gifc cat

hidden message, only visible to user:
Choose one with /gifc #
1)[gif-1]
2)[gif-2]
3)[gif-3]
4)try again
5)cancel

/gifc 2

public message

Giphy BOT
user searched for cat
[gif-2]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.