Outgoing POST request using slack's slash command

2k Views Asked by At

I'm looking to get some help on how I can make my slack bot activate using the slash command and send a POST request to a third party service with a parameter and return back the result.

Basically, I want my bot to do the following:

  1. User types in the command /bot [data]
  2. The app sends an outgoing POST request to a website with that data
  3. Returns the result.

A few things to note: I do not own that third-party websites/services. I am just looking for a way to integrate it to my slack channel to make things faster. I tried to just use postman and send the correct POST request to the server I need and it gets me the result back. I just want to have that same concept as a command in slack.

I looked into the slack API with the events, but it seems like I need to own the site, since slack sends a "challenge" message to verify it and asks for the same message to be returned.

Is there a way I can achieve this using Slack's bot system or is there an other platform that I could use?

I apologize if my question or a smilier one has been asked in the past. I wasn't able to find much info on it.

I appreciate all the help!

1

There are 1 best solutions below

0
On

No. To have a Slack bot interface directly with the third-party service, you would need the owners of that service to change their software.

But you could create your own service that acts as a translation proxy between Slack and the third-party service. Your service would receive messages from Slack, query the third-party service, and then reply to Slack with the results. These are starting points for that solution: