-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from theapexlab/ask-birthday-tests
APEX-1588 - Ask birthday tests
- Loading branch information
Showing
32 changed files
with
1,028 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# The ApiEndpoint of the deployed backend | ||
VITE_API_URL= | ||
# The slack bot token | ||
VITE_SLACK_BOT_TOKEN= | ||
# The slack signing secret | ||
VITE_SLACK_SIGNING_SECRET= | ||
# Your slack user id | ||
VITE_SLACK_USER_ID= | ||
# The slack bots user id | ||
VITE_SLACK_BOT_USER_ID= | ||
# The slack channel id used for testing | ||
VITE_CORE_SLACK_CHANNEL_ID= | ||
# The slack dm id between the bot and you | ||
VITE_SLACK_DM_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
pnpm lint-staged | ||
pnpm build && npx sib --pipeline | ||
pnpm lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Birthday slack bot | ||
|
||
## Description | ||
|
||
Helps teams to find the best birthday gift for their colleagues. | ||
|
||
## Get started | ||
|
||
### Create a New Slack App | ||
|
||
1. Create a new Slack app on the [Slack App Dashboard](https://api.slack.com/apps). (From scratch) | ||
2. Navigate to `Basic Information` and make a copy of your `Signing Secret`. | ||
3. Navigate to `OAuth & Permissions` sub-page -> install app to workspace -> save your `Bot User OAuth Token`. | ||
4. Then scroll below to the `Scopes` section and add these Bot Token Scopes: | ||
|
||
- channels:read | ||
- chat:write | ||
- groups:read | ||
- im:write | ||
- mpim:read | ||
- users:read | ||
- channels:history | ||
- groups:history | ||
- im:history | ||
- mpim:history | ||
|
||
5. Open the `Event Subscriptions` sub-page -> enable events. (We will add the url later.) | ||
6. Scroll below `Subscribe to bot events` and add these scopes: | ||
|
||
- member_joined_channel | ||
- member_left_channel | ||
|
||
### The bot works with two channels: | ||
|
||
- The core channel is the single source of truth regarding members who are part of the team. | ||
- The random channel is where the bot will post the gift wish teaser messsages. | ||
|
||
You can use the same channel for both it is up to you. | ||
|
||
Make sure you have the channel id(s) and add the bot to both channel(s). | ||
|
||
### SST Setup | ||
|
||
1. Ensure you have an AWS IAM user. | ||
2. Set secrets: | ||
|
||
```bash | ||
npx sst secrets set SLACK_LOG_LEVEL debug | ||
npx sst secrets set SLACK_BOT_TOKEN <your-bot-token> | ||
npx sst secrets set SLACK_SIGNING_SECRET <your-signing-secret> | ||
npx sst secrets set CORE_SLACK_CHANNEL_ID <your-test-channel> | ||
npx sst secrets set RANDOM_SLACK_CHANNEL_ID <your-test-channel> | ||
``` | ||
|
||
3. Install dependencies: `pnpm i` | ||
4. Run sst: `pnpm dev` | ||
|
||
### Add webhook url to Slack | ||
|
||
1. Find the ApiEndpoint url of your deployed app in the console output. | ||
2. Open the `Event Subscriptions` sub-page. | ||
3. Add the url: `<ApiEndpoint>/api/slack/callback` to the `Request URL` field. | ||
4. Slack sends a challenge request to the url to verify the endpoint. Make sure you have the app running locally for it to succeed. | ||
|
||
## Run tests | ||
|
||
Copy the `.env` file to a `.env.local` file and add the secrets. | ||
|
||
```bash | ||
pnpm test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"moduleResolution": "node", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/types/*": ["types/*"], | ||
"@/types/*": ["types/*"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.