os / slacker

Full-featured Python interface for the Slack API
Apache License 2.0
1.6k stars 245 forks source link

Add support for using response_url when making posts #91

Open raveious opened 7 years ago

raveious commented 7 years ago

For using slash commands and other interactive buttons, you're given the option to respond using the response_url field value instead of just a normal return within the 3 second limit.

os commented 7 years ago

Hi, @raveious. I'm not sure if I'm following. Could you provide more details on this?

raveious commented 7 years ago

Sure,

When receiving a message from Slack, it will often include a response_url field. https://api.slack.com/slash-commands#responding_to_a_command

If you post to this URL instread of the generic one, slack will handling this differently and renders this differently. This is particularlly useful for when hosting on a server that is particularly slow cough cough free Heroku instance cough

rdkr commented 7 years ago

A workaround is to use Slacker.incomingwebhook:

slack = Slacker('<token>', incoming_webhook_url='<response_url>')
slack.incomingwebhook.post({"text": "It's 80 degrees right now."})