Skip to content

Commit 2351df0

Browse files
authored
feat: added dnd.setSnooze and endSnooze (config: dndNumMinutes) (#6)
1 parent aa0dde9 commit 2351df0

8 files changed

+267
-109
lines changed

CHANGELOG.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

99
## Features
1010

11-
- Resolves [#4](https://github.com/natterstefan/zoom-slack-status-updater/issues/4)),
12-
by adding new `zoomVerificationToken` option to config.
13-
- Only the slack workspace matching the request's `headers.authorization` will
14-
be updated, not all anymore
11+
- `zoomVerificationToken` ensures hook can only be triggered by valid Zoom app
12+
(resolve [#4](https://github.com/natterstefan/zoom-slack-status-updater/issues/4))
13+
- Only slack workspaces with a `zoomVerificationToken` matching the request's
14+
`headers.authorization` will be updated
15+
- set do not disturb when joining Zoom meetings with the new `dndNumMinutes`
16+
setting
1517

1618
## 0.2.0 (2020-05-24)
1719

README.md

+17-7
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ cp now-example.json now.json
4848
### Step 2 - Setup Slack
4949

5050
1. Create a [Slack App](https://api.slack.com/apps) for your workspace(s)
51-
2. Grant each app the `users.profile:write` privilege in `User Token Scopes`
52-
in the `OAuth Tokens & Redirect URLs` view, before clicking on the "Install
53-
App" button.
51+
2. Grant each app the `users.profile:write` **and** `dnd:write` privilege in
52+
`User Token Scopes` in the `OAuth & Permissions` view, before
53+
clicking on the "Install App" button.
5454
3. Copy and paste each `OAuth Access Token` into the configuration file created
5555
in the subsequent step.
5656

@@ -154,6 +154,15 @@ module.exports = [
154154
* @see https://marketplace.zoom.us/docs/api-reference/webhook-reference#headers
155155
*/
156156
zoomVerificationToken: 'Vivamusultricies',
157+
/**
158+
* Slack DnD Status
159+
*
160+
* Turns on Do Not Disturb mode for the current user. Number of minutes,
161+
* from now, to snooze until.
162+
*
163+
* @see https://api.slack.com/methods/dnd.setSnooze
164+
*/
165+
dndNumMinutes: 60,
157166
meetingStatus: {
158167
text: "I'm in a meeting",
159168
emoji: ':warning:', // emoji code
@@ -210,9 +219,9 @@ now ls
210219

211220
## Other solutions
212221

213-
- https://github.com/cmmarslender/zoom-status
214-
- https://github.com/mivok/slack_status_updater with [hammerspoon](http://macappstore.org/hammerspoon/)
215-
- https://github.com/chrisscott/ZoomSlack
222+
- <https://github.com/cmmarslender/zoom-status>
223+
- <https://github.com/mivok/slack_status_updater> with [hammerspoon](http://macappstore.org/hammerspoon/)
224+
- <https://github.com/chrisscott/ZoomSlack>
216225
- [How to automatically update your Slack status with Zapier](https://zapier.com/blog/automate-slack-status/)
217226

218227
## References
@@ -247,4 +256,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
247256

248257
<!-- ALL-CONTRIBUTORS-LIST:END -->
249258

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

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"private": true,
66
"main": "./src/index.js",
77
"scripts": {
8+
"coverage": "jest --coverage",
89
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls",
910
"postinstall": "node scripts/copyfile.js",
1011
"start": "node .",
@@ -24,7 +25,8 @@
2425
"body-parser": "^1.19.0",
2526
"dotenv": "^8.2.0",
2627
"express": "^4.17.1",
27-
"lodash.get": "^4.4.2"
28+
"lodash.get": "^4.4.2",
29+
"qs": "^6.9.4"
2830
},
2931
"devDependencies": {
3032
"@types/jest": "^26.0.3",

slack-status-config-example.js

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ module.exports = [
2626
* @see https://marketplace.zoom.us/docs/api-reference/webhook-reference#headers
2727
*/
2828
zoomVerificationToken: 'Vivamusultricies',
29+
/**
30+
* Slack DnD Status
31+
*
32+
* Turns on Do Not Disturb mode for the current user. Number of minutes,
33+
* from now, to snooze until.
34+
*
35+
* @see https://api.slack.com/methods/dnd.setSnooze
36+
*/
37+
dndNumMinutes: 60,
2938
meetingStatus: {
3039
text: "I'm in a meeting",
3140
emoji: ':warning:', // emoji code

0 commit comments

Comments
 (0)