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