Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack integration #261

Closed
yoavartzi opened this issue Aug 26, 2024 · 0 comments
Closed

Slack integration #261

yoavartzi opened this issue Aug 26, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@yoavartzi
Copy link
Member

The first alternative to email that we should support is Slack (following #260). Users that subscribe to this distribution channel will get their digest via Slack. First step is to learn the Slack API.

@yoavartzi yoavartzi added the enhancement New feature or request label Aug 26, 2024
joannechen1223 added a commit that referenced this issue Oct 29, 2024
…tion (#344)

## Description

This is the very first PR for kicking off the multi-distributing weekly
digest channels and slack integration. I designed the new architecture
with a subscription data model that supports the potential scaling on
two dimensions: sending types and channels. For more information, please
refer to the design doc on
[Notion](https://www.notion.so/Multiple-Distributing-Channels-Slack-Integration-61323d4345c547cb869129e117c5d722).

Here are the changes included in this PR:
1. Add DB migration file to create the subscription table
2. Integrate Slack API and create a testing API to send direct messages

## Related Issue

- #260
- #261

## Notes

<!-- Other thing to say -->

## Test

1. set `SLACK_TOKEN` in your env var (ask me)
2. Run local server
3. Hit `POST /subscriptions/slack/test` with request body
```json
{
    "userId": xxxxx
}
```

## Screenshots (if appropriate):
<img width="736" alt="Screenshot 2024-10-27 at 4 34 16 PM"
src="https://github.com/user-attachments/assets/33a58cf5-596b-43f1-bb9b-d4c20d28dd85">


## TODO

- [x] Clear `console.log` or `console.error` for debug usage
- [ ] Update the documentation `recnet-docs` if needed
swh00tw added a commit that referenced this issue Oct 29, 2024
## RecNet auto-release action
This is an auto-generated PR by recnet-release-action 🤖
Please make sure to test your changes in staging before merging. 
## Related Issues
- #341
- #335
- #301
- #260
- #261
- #342
## Related PRs
- #346
- #344
- #343
## Staging links
recnet-web:
[https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app](https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app)
recnet-api:
[https://dev-api.recnet.io/api](https://dev-api.recnet.io/api)
swh00tw added a commit that referenced this issue Nov 8, 2024
…k digest (#349)

## Description

- Migrate email digest to new subscription architecture and add slack
weekly digest.
- Refactor the email module and add the Slack module.
- Delete testing email/slack API

## Related Issue

- #261
- #260

## Notes

<!-- Other thing to say -->

## Test

<!--- Please describe in detail how you tested your changes locally. -->
1. Insert some subscription data in your local DB.
For example:
```
INSERT INTO "Subscription" ("userId", "type", "channel")
VALUES ('{your user id}, 'WEEKLY_DIGEST', 'SLACK');
```

2. Change the **WEEKLY_DIGEST_CRON** constant in
`recnet-api/modules/subscription/subscription.const.ts` to the time that
close to your current timestamp.
```
export const WEEKLY_DIGEST_CRON = "0 {min} {hour} * * *";
```

3. Start the server locally
```
nx serve recnet-api
```

## Screenshots (if appropriate):

<!--- Add screenshots of your changes here -->
<img width="1462" alt="Screenshot 2024-11-07 at 3 02 26 PM"
src="https://github.com/user-attachments/assets/f01540df-1ef9-4e43-bd05-82e922ac12a2">


## TODO

- [x] Clear `console.log` or `console.error` for debug usage
- [ ] Update the documentation `recnet-docs` if needed
- [ ] Migrate current email subscription for all users
- [ ] Update Slack token on AWS
swh00tw added a commit that referenced this issue Nov 8, 2024
## RecNet auto-release action
This is an auto-generated PR by recnet-release-action 🤖
Please make sure to test your changes in staging before merging. 
## Related Issues
- #260
- #261
## Related PRs
- #350
- #351
- #349
## Staging links
recnet-web:
[https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app](https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app)
recnet-api:
[https://dev-api.recnet.io/api](https://dev-api.recnet.io/api)
swh00tw added a commit that referenced this issue Nov 18, 2024
## Description

<!--- Describe your changes in detail -->
Beautify slack weekly digest template

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

- #261 
- #64 

## Notes

<!-- Other thing to say -->
Misc: I think we should add email and slack testing API endpoints back
to ease the development, but I am not sure where to add it, maybe create
`subscription.controller.ts` again? @joannechen1223

## Test

<!--- Please describe in detail how you tested your changes locally. -->

You will need to add back the `POST /subsriptions/slack/test` endpoint
to test. I will provide example code below in the comment to show how I
use mock data to test it.

## Screenshots (if appropriate):

<!--- Add screenshots of your changes here -->
The data in the screenshot were generated by `generateMock()`.

![Screenshot 2024-11-16 at 11 43
14 PM](https://github.com/user-attachments/assets/0077fe9e-03bf-462f-98e0-e1126c35d462)

## TODO

- [ ] Clear `console.log` or `console.error` for debug usage
- [ ] Update the documentation `recnet-docs` if needed
joannechen1223 added a commit that referenced this issue Nov 19, 2024
## RecNet auto-release action
This is an auto-generated PR by recnet-release-action 🤖
Please make sure to test your changes in staging before merging. 
## Related Issues
- #261
- #64
- #356
- #355
## Related PRs
- #359
- #357
- #358
## Staging links
recnet-web:
[https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app](https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app)
recnet-api:
[https://dev-api.recnet.io/api](https://dev-api.recnet.io/api)
swh00tw added a commit that referenced this issue Dec 2, 2024
## Description

<!--- Describe your changes in detail -->
Finish slack oauth flow.

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

- #261 
- #64 

## Notes

<!-- Other thing to say -->


## Test

<!--- Please describe in detail how you tested your changes locally. -->
Before test, update `.env.local`
- `NEXT_PUBLIC_BASE_URL` should be `https://localhost:3000`
- Add `SLACK_APP_CLIENT_ID`
- Add `SLACK_OAUTH_APP_SCOPES` 
- Add`SLACK_OAUTH_REDIRECT_URI="/api/slack/oauth/callback"`

Run `nx dev:ssl recnet` and go to `https://localhost:3000`
- Go to setting and subscription tab -> Click the button to install
slack app to your workspace
- Should redirect you to slack page
- Should able to choose different workspace
- After clicking "Allow", should redirect back to frontend and see the
success message
- Go to setting again, should see the workspace name of where you
install the app


## Screenshots (if appropriate):

<!--- Add screenshots of your changes here -->
![Screenshot 2024-11-21 at 5 59
40 PM](https://github.com/user-attachments/assets/76d381f6-4dfd-49ee-976a-944b686a6d55)
![Screenshot 2024-11-21 at 5 59
50 PM](https://github.com/user-attachments/assets/092f53a1-81aa-4914-bebb-2ebc6f27f1d5)
![Screenshot 2024-11-21 at 6 00
07 PM](https://github.com/user-attachments/assets/cae362f9-58b8-4b0a-9f2a-ea4c1eb7dfc4)

## TODO

- [ ] Clear `console.log` or `console.error` for debug usage
- [ ] Update the documentation `recnet-docs` if needed
joannechen1223 added a commit that referenced this issue Dec 3, 2024
## RecNet auto-release action
This is an auto-generated PR by recnet-release-action 🤖
Please make sure to test your changes in staging before merging. 
## Related Issues
- #261
- #64
## Related PRs
- #369
- #361
- #365
- #364
- #362
## Staging links
recnet-web:
[https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app](https://vercel.live/link/recnet-git-dev-recnet-542617e7.vercel.app)
recnet-api:
[https://dev-api.recnet.io/api](https://dev-api.recnet.io/api)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

3 participants
@yoavartzi @joannechen1223 and others