├── .gitignore
├── __tests__
├── testPairings.json
├── checkIn.test.ts
├── startConversations.test.ts
└── generatePairs.test.ts
├── babel.config.js
├── utils
├── data
│ └── pairings.json
├── buttons.ts
├── checkMessageHistory.ts
├── startConversations.ts
└── generatePairs.ts
├── scripts
├── checkInScript.ts
├── pairAndConverseScript.ts
└── weeklyInteractionScript.ts
├── tsconfig.json
├── database
├── dbConfig.ts
├── statusDataManager.ts
├── pairsDataManager.ts
├── usersDataManager.ts
└── poolDataManager.ts
├── appConfig.ts
├── README.md
├── .github
└── workflows
│ └── weeklyInteraction.yml
├── package.json
├── pairAndIntroduce.ts
├── lambdaFiles
└── mainLambda.js
├── jest.config.ts
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | bin/
3 | .idea*
4 | .env
--------------------------------------------------------------------------------
/__tests__/testPairings.json:
--------------------------------------------------------------------------------
1 | [["test_channel",["Jia"]]]
2 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | ['@babel/preset-env', {targets: {node: 'current'}}],
4 | '@babel/preset-typescript',
5 | ],
6 | };
--------------------------------------------------------------------------------
/utils/data/pairings.json:
--------------------------------------------------------------------------------
1 | {
2 | "C036L3EUX8R": [
3 | "U02CPHBDP5G",
4 | "U018N3UV6Q7"
5 | ],
6 | "C0412JNN7SQ": [
7 | "U01KD7HUS64",
8 | "UR20JQF34",
9 | "UM4BRPNRZ"
10 | ]
11 | }
--------------------------------------------------------------------------------
/scripts/checkInScript.ts:
--------------------------------------------------------------------------------
1 | import { appConfig } from '../appConfig';
2 | import { sendCheckInDM } from '../utils/buttons';
3 |
4 | sendCheckInDM(appConfig);
5 | console.log("LOG INFO: sent midpoint checkin to all group dms");
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2017",
4 | "module": "commonjs",
5 | "strict": true,
6 | "outDir": "bin",
7 | "esModuleInterop": true,
8 | "resolveJsonModule": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/database/dbConfig.ts:
--------------------------------------------------------------------------------
1 | const AWS = require('aws-sdk');
2 | require('dotenv').config();
3 |
4 | AWS.config.update({
5 | region: process.env.DB_DEFAULT_REGION,
6 | accessKeyId: process.env.DB_ACCESS_KEY_ID,
7 | secretAccessKey: process.env.DB_SECRET_ACCESS_KEY
8 | });
9 |
10 | export const DB_CLIENT = new AWS.DynamoDB.DocumentClient();
--------------------------------------------------------------------------------
/appConfig.ts:
--------------------------------------------------------------------------------
1 | import { App } from '@slack/bolt';
2 | require('dotenv').config();
3 |
4 | // Initializes your app with your bot token and signing secret
5 | export const appConfig = new App({
6 | token: process.env.SLACK_BOT_TOKEN,
7 | signingSecret: process.env.SLACK_SIGNING_SECRET,
8 | socketMode: true,
9 | appToken: process.env.SLACK_APP_TOKEN
10 | });
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # boba-buddies
2 | Sandbox's virtual water cooler conversation app.
3 |
4 |
5 | ## How to Contribute :D
6 | At the current state of things, feel free to take on any open issues and make a PR for it.
7 |
8 | ### Tech Stack
9 | TypeScript
10 | Node.js
11 | Slack Bolt API
12 | Jest Framework for Testing
13 |
14 | ### Wiki
15 | https://www.notion.so/Boba-Buddies-WIP-c90d9071bfad43b4aa679aee7b0eb913#00415aa2d4c14edc979dd3589cf2fdfb
16 |
--------------------------------------------------------------------------------
/scripts/pairAndConverseScript.ts:
--------------------------------------------------------------------------------
1 | import { appConfig } from '../appConfig';
2 | import { generatePairs } from '../utils/generatePairs';
3 | import { startConversations } from '../utils/startConversations';
4 |
5 | const yeet = async () => {
6 | let pairList = await generatePairs(appConfig);
7 | console.log("LOG INFO: pairings for this run is done: ", pairList);
8 | await startConversations(appConfig, pairList);
9 | console.log("LOG INFO: started conversations with the pairings");
10 | }
11 |
12 | yeet();
--------------------------------------------------------------------------------
/database/statusDataManager.ts:
--------------------------------------------------------------------------------
1 | import { DB_CLIENT } from "./dbConfig";
2 |
3 | const STATUS_TABLE: string = "boba-buddies-status";
4 | const STATUS_ID: string = "CURRENT_STATUS";
5 |
6 | export class StatusDataManager {
7 | async getStatus(): Promise {
8 | const getParam = {
9 | TableName: STATUS_TABLE
10 | }
11 |
12 | const result = await DB_CLIENT.scan(getParam).promise();
13 |
14 | return result.Items.map((item: any) => item.shouldPair).every(Boolean);
15 | }
16 |
17 | async putStatus(oldStatus: boolean): Promise {
18 | const putParam = {
19 | TableName: STATUS_TABLE,
20 | Item: {
21 | "weeklyStatus": STATUS_ID,
22 | "shouldPair": !oldStatus
23 | }
24 | }
25 |
26 | return await DB_CLIENT.put(putParam).promise();
27 | }
28 | }
--------------------------------------------------------------------------------
/.github/workflows/weeklyInteraction.yml:
--------------------------------------------------------------------------------
1 | name: "Weekly Interaction"
2 | on:
3 | schedule:
4 | - cron: "0 15 * 1-4,9-12 0"
5 |
6 | jobs:
7 | interact:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v3
11 | - run: npm install
12 | - name: Pair or Check In on Buddies
13 | env:
14 | SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
15 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
16 | SLACK_APP_TOKEN: ${{ secrets.SLACK_APP_TOKEN }}
17 | PAIRINGS_PATH: ${{ secrets.PAIRINGS_PATH }}
18 | DB_ACCESS_KEY_ID: ${{ secrets.DB_ACCESS_KEY_ID }}
19 | DB_SECRET_ACCESS_KEY: ${{ secrets.DB_SECRET_ACCESS_KEY }}
20 | DB_DEFAULT_REGION: ${{ secrets.DB_DEFAULT_REGION }}
21 | run: npm run weekly
22 |
--------------------------------------------------------------------------------
/scripts/weeklyInteractionScript.ts:
--------------------------------------------------------------------------------
1 | import { appConfig } from '../appConfig';
2 | import { sendCheckInDM } from '../utils/buttons';
3 | import { generatePairs } from '../utils/generatePairs';
4 | import { startConversations } from '../utils/startConversations';
5 | import { StatusDataManager } from '../database/statusDataManager';
6 |
7 | const interactWithBuddies = async () => {
8 | const statusManager = new StatusDataManager();
9 |
10 | const shouldPair = await statusManager.getStatus();
11 | console.log(shouldPair
12 | ? "LOG INFO: PAIRING will happen for this week"
13 | : "LOG INFO: CHECKING IN will happen for this week");
14 |
15 | if (shouldPair) {
16 | let pairList = await generatePairs(appConfig);
17 | console.log("LOG INFO: pairings for this run is done: ", pairList);
18 |
19 | await startConversations(appConfig, pairList);
20 | console.log("LOG INFO: started conversations with the pairings");
21 | } else {
22 | await sendCheckInDM(appConfig);
23 | console.log("LOG INFO: sent midpoint checkin to all group dms");
24 | }
25 |
26 | await statusManager.putStatus(shouldPair);
27 | }
28 |
29 | interactWithBuddies();
--------------------------------------------------------------------------------
/database/pairsDataManager.ts:
--------------------------------------------------------------------------------
1 | import { DB_CLIENT } from "./dbConfig";
2 |
3 | const PAIRS_TABLE: string = "boba-buddies-pairs";
4 |
5 | export class PairsDataManager {
6 | async getCurrentPairs(): Promise