Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/onebeyond/bamboohrbot

๐Ÿค– Bot to publish BambooHR notifications (company holidays, work anniversaries, birthdays, and who is at the office) to slack each weekday.
https://github.com/onebeyond/bamboohrbot

bamboohr hacktoberfest serverless slack slackbot

Last synced: 1 day ago
JSON representation

๐Ÿค– Bot to publish BambooHR notifications (company holidays, work anniversaries, birthdays, and who is at the office) to slack each weekday.

Awesome Lists containing this project

README

        

# bamboohrbot


run-tests workflow
deploy-to-aws workflow


all-contributors

๐Ÿค– Bot to publish BambooHR notifications to slack each weekday:

- Who's at the office
- Birthdays
- Work anniversaries, including a welcome message on the first day
- Company-observed holidays

## โš™๏ธ Setup

- Clone the repository and run `npm install`.
- Ensure your [AWS credentials are available](https://serverless.com/framework/docs/providers/aws/guide/credentials/).
- If you have access, generate a [BambooHR API key](https://www.bamboohr.com/api/documentation/) within your account. Otherwise, have a BambooHR admin at your company generate one for you.
- Determine the BambooHR subdomain associated with your company.
- [Create a new app](https://api.slack.com/apps) on your slack organization, give it the `chat:write` and `chat:write.public` scopes, and [install it](https://api.slack.com/start/quickstart#installing) to your workspace.
- Once deployed, it will run from Monday to Friday at 7 a.m. UTC. This can be adjusted in `serverless.yml` file.

### Environment variables

The service needs the following env variables:

```
ENVIRONMENT=
AWS_ACCOUNT_ID=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
BAMBOOHR_SUBDOMAIN=
BAMBOOHR_TIME_OFF_OFFICE_CODE=
EMPLOYEE_COUNTRY_FILTER=
SLACK_CELEBRATIONS_CHANNEL_IDS=
SLACK_BANK_HOLIDAYS_CHANNEL_IDS=
SLACK_OFFICE_CHANNEL_IDS=
```

To run it locally, you can create an `.env` file. To deploy it in the cloud, you need to define them in the CI/CD pipeline, as they are read in the GitHub action that deploys it to AWS.

Apart from the env variables, it will read the `BAMBOOHR_KEY`, `SLACK_SIGNING_SECRET`, `SLACK_BOT_TOKEN` secrets from [AWS Secrets Manager](https://aws.amazon.com/en/secrets-manager/).

## ๐Ÿ—’๏ธ Usage

### Deployment

In order to deploy the code, you need to run the following command:

```
$ serverless deploy
```

### Invocation

After successful deployment, you can invoke the deployed function by using the following command:

```bash
serverless invoke --function main
```

## ๐Ÿ—๏ธ Local development

First you need to create an `.env` file with the following variables:

```
ENVIRONMENT=local
AWS_ACCOUNT_ID=
BAMBOOHR_SUBDOMAIN=
BAMBOOHR_TIME_OFF_OFFICE_CODE=
EMPLOYEE_COUNTRY_FILTER=
AWS_ENDPOINT=http://localhost:4566 # Localstack
AWS_REGION=us-east-1 # Localstack
SLACK_CELEBRATIONS_CHANNEL_IDS=
SLACK_BANK_HOLIDAYS_CHANNEL_IDS=
SLACK_OFFICE_CHANNEL_IDS=
```

Apart from that, you need to create an `.env` file inside the `docker` folder with the following env variables:

```
BAMBOOHR_KEY=
SLACK_SIGNING_SECRET=
SLACK_BOT_TOKEN=
```

And the run [localstack](https://localstack.cloud/) with an instance of AWS Secrets Manager by typing:

```bash
npm run infra:dev:start
```

You can invoke your function locally by using the following command:

```bash
serverless invoke local --function main
```

When you're finished, remember to run:

```bash
npm run infra:dev:stop
```

## ๐Ÿ”— Useful links

- [Slack Block Kit documentation](https://api.slack.com/block-kit)
- [Slack Block Kit builder](https://app.slack.com/block-kit-builder)

## Contributors โœจ

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



รรฑigo Marquรญnez Prado
รรฑigo Marquรญnez Prado

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿš‡ ๐Ÿšง ๐Ÿ‘€ โš ๏ธ
Fran Quesada
Fran Quesada

๐Ÿ› ๐Ÿ’ป ๐Ÿ“– ๐Ÿšง ๐Ÿ‘€
Carlos Jimรฉnez
Carlos Jimรฉnez

๐Ÿ‘€
w3dani
w3dani

๐Ÿš‡ ๐Ÿ‘€

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!