added option to include bot users in channel metadata aggregate (defaults to false - ignore bot users)
breaking change refactored to accept an options object
options object
@property {string} start
Slack timestamp [ts] of the message to begin the scrape from ** non-inclusive **
@property {string} end
Slack timestamp of the last message to scan. Default: most recent message
@property {number} count
number of messages to collect within the start-end range. Default/max: 1000
@property {boolean} private_channel
private channel. must have groups.history permission scope to scrape a private channel. defaults to false (public)
@property {boolean} include_bot
option to include bot users in channel metadata aggregate. defaults to false (ignore bots)
What is Slack-Metadata?
A tool that scans and aggregates Slack channel metadata of all users and bot users in a selected timeframe. See the shape of the metadata at the end of this document for more informationx.
If you would like to help improve this package visit the Github repo
No qualitative message data is read or captured - only quantitative metadata identifiable by the user's Slack user ID
Usage
Parameters
Required
<channel, string>: Slack channel ID to query for message history
<token, string>: Slack oAuth token issued to your app / bot for the Slack team
you must also allow the permissions scope "channels.history"
options object
@property {string} start
Slack timestamp [ts] of the message to begin the scrape from ** non-inclusive **
@property {string} end
Slack timestamp of the last message to scan. Default: most recent message
@property {number} count
number of messages to collect within the start-end range. Default/max: 1000
@property {boolean} private_channel
private channel. must have groups.history permission scope to scrape a private channel. defaults to false (public)
@property {boolean} include_bot
option to include bot users in channel metadata aggregate. defaults to false (ignore bots)
Notes
the start and end strings must be the custom Slack timestamp format returned in any previous metadata scan
if no start / end are passed then the entire message history (up to 1000 messages) will be scanned for metadata
How to use
All you need to supply is an oAuthToken (with the channels.history permission scope set in Slack under oAuth&permissions -> Scopes) from Slack and a valid Slack channel ID of the channel you want to scrape.
Returns a promise
resolves a metadata object [shape detailed below] on success
resolves null on failure if there are no messages within that channel and start/end/count range to scan
Note: the timestamp property is the Slack ts (timestamp) value of the most recent message in the current query
all timestamps are non-inclusive meaning if you pass a starting timestamp you will get metadata for all messages after the message that corresponds to that timestamp
The timestamp can be used for repeated scans by passing it as the start argument. This will collect metadata that never overlaps with previous scans.