-
Notifications
You must be signed in to change notification settings - Fork 121
Document notification settings and snooze API endpoints #392
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
Open
robzolkos
wants to merge
6
commits into
basecamp:master
Choose a base branch
from
robzolkos:rzolkos/notification-settings-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2b29c5c
Add notification settings and snooze API documentation (#9931)
robzolkos 0239685
Remove incorrect bundle_enabled/schedule_enabled constraint
robzolkos 7d4f4ed
Merge master into rzolkos/notification-settings-docs
robzolkos bc8a560
Align reminder fields and error format in notification settings docs
robzolkos 1ed0fdb
Correct GET response fields and error format to match actual API
robzolkos bc02b22
Document validation constraints for notification settings and snooze …
robzolkos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,139 @@ | ||
| Notification settings | ||
| ===================== | ||
|
|
||
| Endpoints for reading and updating the current user's notification preferences, including delivery platform, granularity, schedule, reminders, and snoozing. | ||
|
|
||
| Endpoints: | ||
|
|
||
| - [Get notification settings](#get-notification-settings) | ||
| - [Update notification settings](#update-notification-settings) | ||
| - [Snooze notifications](#snooze-notifications) | ||
|
|
||
|
|
||
| Get notification settings | ||
| ------------------------- | ||
|
|
||
| * `GET /my/notifications/settings.json` will return the current user's notification settings. | ||
|
|
||
| ###### Example JSON Response | ||
| <!-- START GET /my/notifications/settings.json --> | ||
| ```json | ||
| { | ||
| "platform": "web_and_email", | ||
| "granularity": "everything", | ||
| "show_badge_counts": true, | ||
| "schedule_enabled": false, | ||
| "schedule": null, | ||
| "bundle_enabled": true, | ||
| "schedule_entries_reminders": true, | ||
| "due_assignments_reminders": true, | ||
| "state": "on" | ||
| } | ||
| ``` | ||
| <!-- END GET /my/notifications/settings.json --> | ||
|
|
||
| When `schedule_enabled` is `true`, the `schedule` object is included: | ||
|
|
||
| ```json | ||
| { | ||
| "schedule_enabled": true, | ||
| "schedule": { | ||
| "start_hour": 9, | ||
| "end_hour": 17, | ||
| "work_days": [1, 2, 3, 4, 5] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ###### Copy as cURL | ||
|
|
||
| ```shell | ||
| curl -s -H "Authorization: Bearer $ACCESS_TOKEN" https://3.basecampapi.com/$ACCOUNT_ID/my/notifications/settings.json | ||
| ``` | ||
|
|
||
|
|
||
| Update notification settings | ||
| ---------------------------- | ||
|
|
||
| * `PUT /my/notifications/settings.json` will update the current user's notification settings. Only the provided parameters are changed; omitted parameters remain unchanged. Returns `204 No Content` on success. | ||
|
|
||
| _Optional parameters_: | ||
|
|
||
| * `platform` - delivery platform. Valid options: `web`, `email`, `web_and_email`. | ||
| * `granularity` - notification granularity. Valid options: `everything`, `pings_and_mentions`. | ||
| * `show_badge_counts` - whether to show badge counts. JSON `true` or `false` (not strings). | ||
| * `schedule_enabled` - whether the notification schedule is active. JSON `true` or `false` (not strings). When `true`, also provide `schedule`. | ||
| * `schedule` - an object with `start_hour` (integer 0–23), `end_hour` (integer 0–23, must be greater than `start_hour`), and `work_days` (non-empty array of integers, 0=Sunday through 6=Saturday). | ||
| * `bundle_enabled` - whether notification bundling is enabled. JSON `true` or `false` (not strings). | ||
| * `reminders` - an array of reminder types to enable. Valid values: `schedule_entries`, `due_assignments`. Pass an empty array to disable all reminders. These correspond to the `schedule_entries_reminders` and `due_assignments_reminders` boolean fields in the GET response. | ||
|
|
||
| Providing an invalid `platform` or `granularity` returns `422 Unprocessable Entity` with an error listing the valid options: | ||
|
|
||
| ```json | ||
| { | ||
| "errors": ["Invalid platform 'carrier_pigeon'. Valid options: web, email, web_and_email"] | ||
robzolkos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| ``` | ||
|
|
||
| ###### Example JSON Request | ||
| <!-- START PUT PAYLOAD /my/notifications/settings.json --> | ||
| ```json | ||
| { | ||
| "platform": "email", | ||
| "granularity": "pings_and_mentions", | ||
| "schedule_enabled": true, | ||
| "schedule": { | ||
| "start_hour": 9, | ||
| "end_hour": 17, | ||
| "work_days": [1, 2, 3, 4, 5] | ||
| }, | ||
| "bundle_enabled": true, | ||
| "reminders": ["schedule_entries", "due_assignments"] | ||
| } | ||
| ``` | ||
| <!-- END PUT PAYLOAD /my/notifications/settings.json --> | ||
|
|
||
| ###### Copy as cURL | ||
|
|
||
| ```shell | ||
| curl -s -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ | ||
| -d '{"platform":"email","granularity":"pings_and_mentions"}' -X PUT \ | ||
| https://3.basecampapi.com/$ACCOUNT_ID/my/notifications/settings.json | ||
| ``` | ||
|
|
||
|
|
||
| Snooze notifications | ||
| -------------------- | ||
|
|
||
| * `PUT /my/notifications/snooze.json` will snooze the current user's notifications for the given duration. Returns `200 OK` with the snooze state. | ||
|
|
||
| **Required parameters**: | ||
|
|
||
| * `duration` - a positive integer representing the number of seconds to snooze notifications. | ||
|
|
||
| ###### Example JSON Response | ||
| <!-- START PUT /my/notifications/snooze.json --> | ||
| ```json | ||
| { | ||
| "state": "snoozed", | ||
| "off_until": "2024-12-05T15:00:00Z" | ||
| } | ||
| ``` | ||
| <!-- END PUT /my/notifications/snooze.json --> | ||
|
|
||
| ###### Example JSON Request | ||
| <!-- START PUT PAYLOAD /my/notifications/snooze.json --> | ||
| ```json | ||
| { | ||
| "duration": 10800 | ||
| } | ||
| ``` | ||
| <!-- END PUT PAYLOAD /my/notifications/snooze.json --> | ||
|
|
||
| ###### Copy as cURL | ||
|
|
||
| ```shell | ||
| curl -s -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ | ||
| -d '{"duration":10800}' -X PUT \ | ||
| https://3.basecampapi.com/$ACCOUNT_ID/my/notifications/snooze.json | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.