notifications
Creates, updates, deletes, gets or lists a notifications resource.
Overview
| Name | notifications |
| Type | Resource |
| Id | github.activity.notifications |
Fields
The following fields are returned by SELECT queries:
- list_repo_notifications_for_authenticated_user
- get_thread
- list_notifications_for_authenticated_user
Response
| Name | Datatype | Description |
|---|---|---|
id | string | |
last_read_at | string | |
reason | string | |
repository | object | Minimal Repository (title: Minimal Repository) |
subject | object | |
subscription_url | string | (example: https://api.github.com/notifications/threads/2/subscription) |
unread | boolean | |
updated_at | string | |
url | string |
Response
| Name | Datatype | Description |
|---|---|---|
id | string | |
last_read_at | string | |
reason | string | |
repository | object | Minimal Repository (title: Minimal Repository) |
subject | object | |
subscription_url | string | (example: https://api.github.com/notifications/threads/2/subscription) |
unread | boolean | |
updated_at | string | |
url | string |
Response
| Name | Datatype | Description |
|---|---|---|
id | string | |
last_read_at | string | |
reason | string | |
repository | object | Minimal Repository (title: Minimal Repository) |
subject | object | |
subscription_url | string | (example: https://api.github.com/notifications/threads/2/subscription) |
unread | boolean | |
updated_at | string | |
url | string |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_repo_notifications_for_authenticated_user | select | owner, repo | all, participating, since, before, per_page, page | Lists all notifications for the current user in the specified repository. |
get_thread | select | thread_id | Gets information about a notification thread. | |
list_notifications_for_authenticated_user | select | all, participating, since, before, page, per_page | List all notifications for the current user, sorted by most recently updated. | |
mark_thread_as_read | update | thread_id | Marks a thread as "read." Marking a thread as "read" is equivalent to clicking a notification in your notification inbox on GitHub: https://github.com/notifications. | |
mark_thread_as_done | delete | thread_id | Marks a thread as "done." Marking a thread as "done" is equivalent to marking a notification in your notification inbox on GitHub as done: https://github.com/notifications. | |
mark_notifications_as_read | exec | Marks all notifications as "read" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false. | ||
mark_repo_notifications_as_read | exec | owner, repo | Marks all notifications in a repository as "read" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List repository notifications for the authenticated user endpoint and pass the query parameter all=false. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
thread_id | integer | The unique identifier of the notification thread. This corresponds to the value returned in the id field when you retrieve notifications (for example with the GET /notifications operation). |
all | boolean | If true, show notifications marked as read. |
before | string (date-time) | Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
participating | boolean | If true, only shows notifications in which the user is directly participating or mentioned. |
per_page | integer | The number of results per page (max 50). For more information, see "Using pagination in the REST API." |
since | string (date-time) | Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
SELECT examples
- list_repo_notifications_for_authenticated_user
- get_thread
- list_notifications_for_authenticated_user
Lists all notifications for the current user in the specified repository.
SELECT
id,
last_read_at,
reason,
repository,
subject,
subscription_url,
unread,
updated_at,
url
FROM github.activity.notifications
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND all = '{{ all }}'
AND participating = '{{ participating }}'
AND since = '{{ since }}'
AND before = '{{ before }}'
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
Gets information about a notification thread.
SELECT
id,
last_read_at,
reason,
repository,
subject,
subscription_url,
unread,
updated_at,
url
FROM github.activity.notifications
WHERE thread_id = '{{ thread_id }}' -- required
;
List all notifications for the current user, sorted by most recently updated.
SELECT
id,
last_read_at,
reason,
repository,
subject,
subscription_url,
unread,
updated_at,
url
FROM github.activity.notifications
WHERE all = '{{ all }}'
AND participating = '{{ participating }}'
AND since = '{{ since }}'
AND before = '{{ before }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
UPDATE examples
- mark_thread_as_read
Marks a thread as "read." Marking a thread as "read" is equivalent to clicking a notification in your notification inbox on GitHub: https://github.com/notifications.
UPDATE github.activity.notifications
SET
-- No updatable properties
WHERE
thread_id = '{{ thread_id }}' --required;
DELETE examples
- mark_thread_as_done
Marks a thread as "done." Marking a thread as "done" is equivalent to marking a notification in your notification inbox on GitHub as done: https://github.com/notifications.
DELETE FROM github.activity.notifications
WHERE thread_id = '{{ thread_id }}' --required
;
Lifecycle Methods
- mark_notifications_as_read
- mark_repo_notifications_as_read
Marks all notifications as "read" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.
EXEC github.activity.notifications.mark_notifications_as_read
@@json=
'{
"last_read_at": "{{ last_read_at }}",
"read": {{ read }}
}'
;
Marks all notifications in a repository as "read" for the current user. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List repository notifications for the authenticated user endpoint and pass the query parameter all=false.
EXEC github.activity.notifications.mark_repo_notifications_as_read
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required
@@json=
'{
"last_read_at": "{{ last_read_at }}"
}'
;