Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make it so that slack bots can use Giphy?

For some reason, the existing Giphy app for slack does not allow bots to call a GIF from giphy.com

If I type "/Giphy sad", the Giphy app will automatically load a sad GIF of somekind from Giphy.com

But if my slackbot does it, or my hubot, or my twitterbot, or any bot that I create, even if the text is identical, it won't work. I'm assuming this is because giphy intentionally excluded bots from being able to call the command? Or is it that bots can't call commands in general?

So in addition to this general question, my specific coding question is: what would be the best way to make it so that a slack app or a bot can call a GIF from Giphy?


additional info you may not need: -I'm creating this so that we can pull "moods" off of Twitter account into a slack channel and have a bunch of GIFs show up in that slack channel that represent the mood of the tweets. -I've been using Node-Red to do some of this -I've tried using the built in twitter app for slack, no dice

like image 770
leigh Avatar asked Mar 13 '16 04:03

leigh


1 Answers

I'm assuming this is because giphy intentionally excluded bots from being able to call the command? Or is it that bots can't call commands in general?

Bot users cannot invoke Slash commands. This is a restriction by Slack and not Giphy or any other integration. :(

So if you want to get gifs from Giphy, you will have to implement that yourself using the Giphy API. Thankfully, the Giphy API is super easy to use. Giphy API

In a recent hackathon project I built this for Slack, which you may find useful. It get's a random gif that is tagged "fail" from Giphy and then posts it as a message in Slack.

like image 126
Wilhelm Klopp Avatar answered Nov 10 '22 04:11

Wilhelm Klopp