An open API service indexing awesome lists of open source software.

https://github.com/maxchehab/user-sync-api


https://github.com/maxchehab/user-sync-api

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# user-sync-api
This api syncs a workspace's Slack directory while making use of Slack's web api and webhooks.

## Getting started
```bash
cd $GOPATH/src && git clone https://github.com/maxchehab/user-sync-api.git && cd user-sync-api
govendor sync
```

## `secrets.env`
At this point you will want to create your `secrets.env` file. This file is placed at the **root** of the project. It's contents are structured like so...
```bash
# secrets.env
export DATABASE_URL=postgres://xxxxxxx:xxxxx@xxxxx:5432/xxxxxxxx
export botToken=xoxb-xxxxxxx-xxxx-xxxxxx
export token=xxxxxxxxxx
export PORT=8080
export apiKey=xxxxxx
```
`botToken` is the `Bot User OAuth Access Token` generated by Slack.

`token` is the `Verification Token` generated by Slack.

`apiKey` is an unique string you create for the api to be accessed from a client.

## Running
After you have created `secrets.env` you can procede to run the api.

```bash
source secrets.env
make
```

## Webhook
This api offers a webhook endpoint for Slack's event monitoring. It accepts `team_join` and `user_change` event types.
This endpoint is available at `/`.

## Users api
A single endpoint `/users` is available to access the list of synced users. All requests must be authenticated using the generated `apiKey` specified in `secrets.env`.
An example request would look like: `https://usersync-max.herokuapp.com/users?apikey=xxxxxxxx`. This is a `GET` request.