Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marshallasch/slack-name-bot
Slack Bot for Keeping track of who users are
https://github.com/marshallasch/slack-name-bot
bot bot-users nodejs slack
Last synced: 22 days ago
JSON representation
Slack Bot for Keeping track of who users are
- Host: GitHub
- URL: https://github.com/marshallasch/slack-name-bot
- Owner: MarshallAsch
- License: mit
- Created: 2019-12-12T17:11:32.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T16:59:26.000Z (about 2 years ago)
- Last Synced: 2024-11-01T05:42:20.560Z (2 months ago)
- Topics: bot, bot-users, nodejs, slack
- Language: JavaScript
- Size: 454 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Tracking Slack Name and Email Changes
This Slack app is based off of the [template-terms-of-service](https://github.com/slackapi/template-terms-of-service) sample app.
This Slack app will receive an event every time a user signs up for the workspace or changes their details.
Any workspace administrator is able to query the history using the slash command `/whois [@user]`.## Setup
#### Create a Slack app
1. [Create an app](https://api.slack.com/apps)
2. Go to **Bot Users** and click "Add a Bot User" to create a, app bot. Save the change.
3. Enable Interactive components (See *Enable Interactive Components* below)
4. Navigate to the **OAuth & Permissions** page and add the following scopes:
* `bot`
* `chat:write:bot`
* `commands`
* `users:read`
* `users:read:email`
* `team:read`
* `channels:read`
5. Click 'Save Changes' and install the app (You should get an OAuth access token after the installation)
6. Enable the events (See *Enable the Events API* below. It doesn't let you the Request URL until you run the code!)
7. In your Slack workspace, invite the bot to #general, where the new user will join.#### Run locally
1. Get the code
* Either clone this repo and run `npm install`
* Or run it as a docker container `docker pull marshallasch/slack-name-bot`
2. Set the following environment variables to `config.ini` (see `config.ini.tmp`):
* Note this will be created by `docker run marshallasch/slack-name-bot` as long as the variables are set
* `SLACK_ACCESS_TOKEN`: Your app's `xoxb-` token (available on the Install App page, after you install the app to a workspace once.)
* `SLACK_SIGNING_SECRET`: Your app's Signing Secret (available on the **Basic Information** page)
* `SLACK_CLIENT_SECRET`: Your app's Client Secret (available on the **Basic Information** page)
* `SLACK_CLIENT_ID`: Your app's ID (available on the **Basic Information** page)* `DATABASE` the data base name to use
* `DB_PORT` the mongo db port to connect to (default is 27017)
* `DB_HOST` the host of the mongo db server
* `DB_USER` the mongo db user name
* `DB_PASS` the plain text mogodb password
3. If you're running the app locally:
* Start the app (`npm start`)#### Enable the Events API
1. Go back to the app settings and click on Events Subscriptions
1. Set the Request URL to your server (*e.g.* `https://yourname.ngrok.com`) + `/events`
1. On the same page, subscribe to the `team_join` and `user_change` workspace events#### Enable the Slash Commands
1. Go back to the app settings and click on Slash Commands
1. Set the Request URL to your server (*e.g.* `https://yourname.ngrok.com`) + `/command`
1. On the same page, set the command name to `/whois` and the description
1. On the same page, check the `Escape channels, users, and links sent to your app` checkbox### Requirements
This application requires a connection to mongodb
To create the mongodb database and user account run
```
use slack_users
db.createUser(
{
user: "slackBot",
pwd: "slackpass",
roles: [ "readWrite" ]
}
)
```From a mongo shell on the db server.