Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarquas/slack-web-info
https://github.com/tarquas/slack-web-info
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tarquas/slack-web-info
- Owner: tarquas
- License: mit
- Created: 2014-11-03T10:09:22.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-19T09:51:54.000Z (almost 10 years ago)
- Last Synced: 2024-11-28T23:17:58.142Z (about 2 months ago)
- Language: JavaScript
- Size: 156 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Slack Web Info
==============Slack bulk information provider high-scalable NodeJS module
This is official code repository of this project.
## Project Official Website
http://194.44.203.87/projects/slack-web-info/
# Installation
$ `npm i slack-web-info`
# Quick Usage
```javascript
var SlackWebInfo = require( 'slack-web-info' );var config = {
company : 'mycompany', // use 'http://mycompany.slack.com/` entry
email : '[email protected]', // logon data
password : 'bot-password',
cacheTime : 2 * 60 * 1000, // cache information for 2 minutes
};var slackInfo = new SlackWebInfo( config );
slackInfo.getInfo( [ 'users', 'presence', 'active' ], function( err, info ) {
if ( info ) {
console.log(
'Full names of users with "online" status:',
info.map( function( user ) { return user.profile.real_name; }
)
} else
console.log( 'No users with "online" status found' );
} )slackInfo.getInfo( [ 'users', 'real_name', 'John Smith' ], function( err, info ) {
if ( info ) {
console.log(
'Is John Smith "online"?',
info.presence == 'active' ? 'Yes' : 'No'
)
} else
console.log( 'John Smith is not found' );
} )slackInfo.getInfo( [ 'users', 'email', '[email protected]' ], function( err, info ) {
if ( info ) {
console.log( 'Data of user with email: [email protected]' );
console.log( ' Phone:', info.profile.phone || 'Not Specified' );
console.log( ' Time Zone:', info.tz );
} else
console.log( 'User with email: [email protected] not found' );
} )slackInfo.getInfo( [ 'users' ], function( err, info ) {
if ( !err ) {
var
humans = users.is_bot.false,
nHumans = humans ? humans.length : 0,
bots = users.is_bot.true,
nBots = bots ? bots.length : 0;
console.log(
'Employees:',
info.presence.active.length - nBots, 'online from',
nHumans, 'total'
)
} else
console.log( 'Error:', err );
} )```