17

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

Eugene
  • 10,957
  • 20
  • 69
  • 97
leigh
  • 309
  • 1
  • 2
  • 8

2 Answers2

15

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.

Wilhelm Klopp
  • 5,030
  • 2
  • 29
  • 37
  • very cool. I'm assuming that code was for a slack bot you created as a slack integration? If yes, could it then take a message from an outside source? say as a string? Say for example, I use Node-Red to send a message from a Raspberry Pi2 that "you left the stove on in your house", could your bot then post a GIF of your house on fire? – leigh Mar 14 '16 at 00:23
  • If you change the giphy query, sure! – Wilhelm Klopp Mar 14 '16 at 00:40
0

The official API does not support invoking other slash commands, but there is an unofficial API method that does it:chat.command.

Note that this will only work in situations where you have full control over a Slack workspace and can use legacy tokens.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114