Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get logged in user's IP in slack

I want to setup a slash command /ip that could give me the ip of current logged in user. I tried setting up same but whenever I try to use /ip it gives this as output which is definitely not my public ip(this keeps changing). it is actually giving ip of slack server's.

I am using this service to get ip. I know I can get the user's ip through this, but I want an alternate for this paid feature.

enter image description here

like image 605
prashantitis Avatar asked Aug 29 '16 20:08

prashantitis


2 Answers

I have been able to achieve this by looking the user id up in the slack accessLog api, you can then find the last login ip of the user, but you will need admin scope token.

like image 132
Billy Li Avatar answered Sep 22 '22 18:09

Billy Li


The Slash Command URL that you are hosting is invoked by the Slack Servers for you, in response to a message in your team. So the IP address that you are interpreting is that of the Slack Server and not of your machine.

I am not sure if what you want to achieve is going to be possible since Slack Infrastructure is in the middle interpreting your commands and calling external integrations (like your Slash Command URL).

like image 25
Romin Avatar answered Sep 24 '22 18:09

Romin