Retrieve comments on a file?

38 views
Skip to first unread message

Jed Wood

unread,
Mar 27, 2014, 12:11:06 PM3/27/14
to slac...@googlegroups.com
As far as I can tell, one cannot currently get comments on a file from the API. When calling files.list, each file includes a "comments_count" property and the initial comment when the file was uploaded, where applicable. But but I can't see how to get the actual comments.

The best workaround I've come up with this far is:

1- call channel.history for the channel in question
2- filter for items that have a "file" attribute, with "file.id" matching the id of the file in question.

Depending on the volume of messages coming through the channel, this can fairly quickly fail since the upper limit of returned results is 1000, meaning I'll have to implement a polling solution and then store the comments offsite, at which point I might as well use workaround #2:

1- have a webhook get pinged for every message posted to the channel in question.
2- if match on "file" and "file.id" then save to my own store.


On a related note, is there a way to get the details for a single file? Based on some quick testing, it seems the search.files call doesn't allow you to search by ID, for example.

Thanks,
-Jed 

Jed Wood

unread,
Mar 27, 2014, 1:09:24 PM3/27/14
to slac...@googlegroups.com
Oops. Worse than I thought. The info included with the WebHook is really minimal and doesn't include the details of the comment (nor even whether it's a comment or something else), so it's back to all kinds of polling and filtering and fun.




--
You received this message because you are subscribed to a topic in the Google Groups "Slack API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/slack-api/GoViPtncnMg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to slack-api+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Hammond

unread,
Mar 27, 2014, 7:36:46 PM3/27/14
to Jed Wood, slac...@googlegroups.com
Hi Jed,

I'm sorry that the API didn't do what you wanted it to. We've just released https://api.slack.com/methods/files.info - does that work for you?

Paul


--
You received this message because you are subscribed to the Google Groups "Slack API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slack-api+...@googlegroups.com.

Jed Wood

unread,
Mar 28, 2014, 1:51:04 PM3/28/14
to Paul Hammond, slac...@googlegroups.com
That's perfect, thanks Paul! Did you do that based just on my request? :)

By the way, it looks like this repo is no longer the up-to-date source for documentation? https://github.com/tinyspeck/SlackApiDocs

Thanks,
-Jed

Paul Hammond

unread,
Mar 28, 2014, 6:42:23 PM3/28/14
to Jed Wood, slac...@googlegroups.com
We were planning on releasing that method soon, your email pushed it to the top of the queue. I was surprised at how closely it matched what you needed.

And yes, we've not been great at keeping the API docs repository up to date. Sorry about that - it's on my list to fix early next week.

Paul

Paul Hammond

unread,
Apr 7, 2014, 1:58:21 PM4/7/14
to Jed Wood, slac...@googlegroups.com
Just to follow up on this: the SlackApiDocs repo is now up to date with all the changes that have been made in the last few months: https://github.com/tinyspeck/SlackApiDocs/commits/master

It's an external mirror of an internal repository so updates won't always show up immediately. But we're going to do a better job of keeping it up to date from now on,

Thanks,

Paul

 
Reply all
Reply to author
Forward
0 new messages