Skip to main content

notifications

Creates, updates, deletes, gets or lists a notifications resource.

Overview

Namenotifications
TypeResource
Idgithub.activity.notifications

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idstring
last_read_atstring
reasonstring
repositoryobjectMinimal Repository (title: Minimal Repository)
subjectobject
subscription_urlstring (example: https://api.github.com/notifications/threads/2/subscription)
unreadboolean
updated_atstring
urlstring

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_repo_notifications_for_authenticated_userselectowner, repoall, participating, since, before, per_page, pageLists all notifications for the current user in the specified repository.
get_threadselectthread_idGets information about a notification thread.
list_notifications_for_authenticated_userselectall, participating, since, before, page, per_pageList all notifications for the current user, sorted by most recently updated.
mark_thread_as_readupdatethread_idMarks 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_donedeletethread_idMarks 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_readexecMarks 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_readexecowner, repoMarks 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.

NameDatatypeDescription
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
thread_idintegerThe 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).
allbooleanIf true, show notifications marked as read.
beforestring (date-time)Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
participatingbooleanIf true, only shows notifications in which the user is directly participating or mentioned.
per_pageintegerThe number of results per page (max 50). For more information, see "Using pagination in the REST API."
sincestring (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

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 }}'
;

UPDATE examples

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

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

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 }}
}'
;