Skip to content

Commit 3ae481e

Browse files
authored
Add webhook events for discussions (#18442)
1 parent 5ee9876 commit 3ae481e

7 files changed

Lines changed: 457 additions & 0 deletions

File tree

content/developers/webhooks-and-events/webhook-events-and-payloads.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,60 @@ Key | Type | Description
337337
338338
{{ webhookPayloadsForCurrentVersion.deployment_status }}
339339
340+
{% if currentVersion == "free-pro-team@latest" %}
341+
### discussion
342+
343+
{% data reusables.webhooks.discussions-webhooks-beta %}
344+
345+
Activity related to a discussion. For more information, see the "[Using the GraphQL API for discussions](/graphql/guides/using-the-graphql-api-for-discussions)."
346+
#### Availability
347+
348+
- Repository webhooks
349+
- Organization webhooks
350+
- {% data variables.product.prodname_github_app %}s with the `discussions` permission
351+
352+
#### Webhook payload object
353+
354+
Key | Type | Description
355+
----|------|-------------
356+
`action` |`string` | The action performed. Can be `created`, `edited`, `deleted`, `pinned`, `unpinned`, `locked`, `unlocked`, `transferred`, `category_changed`, `answered`, or `unanswered`.
357+
{% data reusables.webhooks.discussion_desc %}
358+
{% data reusables.webhooks.repo_desc_graphql %}
359+
{% data reusables.webhooks.org_desc_graphql %}
360+
{% data reusables.webhooks.sender_desc %}
361+
362+
#### Webhook payload example
363+
364+
{{ webhookPayloadsForCurrentVersion.discussion.created }}
365+
366+
### discussion_comment
367+
368+
{% data reusables.webhooks.discussions-webhooks-beta %}
369+
370+
Activity related to a comment in a discussion. For more information, see "[Using the GraphQL API for discussions](/graphql/guides/using-the-graphql-api-for-discussions)."
371+
372+
#### Availability
373+
374+
- Repository webhooks
375+
- Organization webhooks
376+
- {% data variables.product.prodname_github_app %}s with the `discussions` permission
377+
378+
#### Webhook payload object
379+
380+
Key | Type | Description
381+
----|------|-------------
382+
`action` |`string` | The action performed. Can be `created`, `edited`, or `deleted`.
383+
`comment` | `object` | The [`discussion comment`](/graphql/guides/using-the-graphql-api-for-discussions#discussioncomment) resource.
384+
{% data reusables.webhooks.discussion_desc %}
385+
{% data reusables.webhooks.repo_desc_graphql %}
386+
{% data reusables.webhooks.org_desc_graphql %}
387+
{% data reusables.webhooks.sender_desc %}
388+
389+
#### Webhook payload example
390+
391+
{{ webhookPayloadsForCurrentVersion.discussion_comment.created }}
392+
{% endif %}
393+
340394
{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}
341395
342396
### enterprise
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`discussion` | `object` | The [`discussion`](/graphql/guides/using-the-graphql-api-for-discussions#discussion) resource.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% note %}
2+
3+
**Note:** Webhook events for {% data variables.product.prodname_discussions %} are currently in beta and subject to change.
4+
5+
{% endnote %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`organization` | `object` | Webhook payloads contain the [`organization`](/graphql/reference/objects#organization) object when the webhook is configured for an organization or the event occurs from activity in a repository owned by an organization.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`repository` | `object` | The [`repository`](/graphql/reference/objects#repository) where the event occurred.
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
{
2+
"action": "created",
3+
"discussion": {
4+
"repository_url": "https://api.github.com/repos/octo-org/octo-repo",
5+
"category": {
6+
"id": 32784361,
7+
"repository_id": 17273051,
8+
"emoji": ":speech_balloon:",
9+
"name": "General",
10+
"description": "Chat about anything and everything here",
11+
"created_at": "2021-03-24T12:41:54.000-05:00",
12+
"updated_at": "2021-03-24T12:41:54.000-05:00",
13+
"slug": "general",
14+
"is_answerable": false
15+
},
16+
"answer_html_url": null,
17+
"answer_chosen_at": null,
18+
"answer_chosen_by": null,
19+
"html_url": "https://github.com/octo-org/octo-repo/discussions/90",
20+
"id": 3297442,
21+
"node_id": "MDEwOkRpc2N1c3Npb24zMjk3NDQy",
22+
"number": 90,
23+
"title": "Welcome to discussions!",
24+
"user": {
25+
"login": "Codertocat",
26+
"id": 21031067,
27+
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
28+
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
29+
"gravatar_id": "",
30+
"url": "https://api.github.com/users/Codertocat",
31+
"html_url": "https://github.com/Codertocat",
32+
"followers_url": "https://api.github.com/users/Codertocat/followers",
33+
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
34+
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
35+
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
36+
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
37+
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
38+
"repos_url": "https://api.github.com/users/Codertocat/repos",
39+
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
40+
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
41+
"type": "User",
42+
"site_admin": false
43+
},
44+
"state": "open",
45+
"locked": false,
46+
"comments": 0,
47+
"created_at": "2021-03-29T14:16:08Z",
48+
"updated_at": "2021-03-29T14:16:08Z",
49+
"author_association": "COLLABORATOR",
50+
"active_lock_reason": null,
51+
"body": "We're glad to have you here!"
52+
},
53+
"repository": {
54+
"id": 17273051,
55+
"node_id": "MDEwOlJlcG9zaXRvcnkxNzI3MzA1MQ==",
56+
"name": "octo-repo",
57+
"full_name": "octo-org/octo-repo",
58+
"private": true,
59+
"owner": {
60+
"login": "octo-org",
61+
"id": 6811672,
62+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjY4MTE2NzI=",
63+
"avatar_url": "https://avatars.githubusercontent.com/u/6811672?v=4",
64+
"gravatar_id": "",
65+
"url": "https://api.github.com/users/octo-org",
66+
"html_url": "https://github.com/octo-org",
67+
"followers_url": "https://api.github.com/users/octo-org/followers",
68+
"following_url": "https://api.github.com/users/octo-org/following{/other_user}",
69+
"gists_url": "https://api.github.com/users/octo-org/gists{/gist_id}",
70+
"starred_url": "https://api.github.com/users/octo-org/starred{/owner}{/repo}",
71+
"subscriptions_url": "https://api.github.com/users/octo-org/subscriptions",
72+
"organizations_url": "https://api.github.com/users/octo-org/orgs",
73+
"repos_url": "https://api.github.com/users/octo-org/repos",
74+
"events_url": "https://api.github.com/users/octo-org/events{/privacy}",
75+
"received_events_url": "https://api.github.com/users/octo-org/received_events",
76+
"type": "Organization",
77+
"site_admin": false
78+
},
79+
"html_url": "https://github.com/octo-org/octo-repo",
80+
"description": "My first repo on GitHub!",
81+
"fork": false,
82+
"url": "https://api.github.com/repos/octo-org/octo-repo",
83+
"forks_url": "https://api.github.com/repos/octo-org/octo-repo/forks",
84+
"keys_url": "https://api.github.com/repos/octo-org/octo-repo/keys{/key_id}",
85+
"collaborators_url": "https://api.github.com/repos/octo-org/octo-repo/collaborators{/collaborator}",
86+
"teams_url": "https://api.github.com/repos/octo-org/octo-repo/teams",
87+
"hooks_url": "https://api.github.com/repos/octo-org/octo-repo/hooks",
88+
"issue_events_url": "https://api.github.com/repos/octo-org/octo-repo/issues/events{/number}",
89+
"events_url": "https://api.github.com/repos/octo-org/octo-repo/events",
90+
"assignees_url": "https://api.github.com/repos/octo-org/octo-repo/assignees{/user}",
91+
"branches_url": "https://api.github.com/repos/octo-org/octo-repo/branches{/branch}",
92+
"tags_url": "https://api.github.com/repos/octo-org/octo-repo/tags",
93+
"blobs_url": "https://api.github.com/repos/octo-org/octo-repo/git/blobs{/sha}",
94+
"git_tags_url": "https://api.github.com/repos/octo-org/octo-repo/git/tags{/sha}",
95+
"git_refs_url": "https://api.github.com/repos/octo-org/octo-repo/git/refs{/sha}",
96+
"trees_url": "https://api.github.com/repos/octo-org/octo-repo/git/trees{/sha}",
97+
"statuses_url": "https://api.github.com/repos/octo-org/octo-repo/statuses/{sha}",
98+
"languages_url": "https://api.github.com/repos/octo-org/octo-repo/languages",
99+
"stargazers_url": "https://api.github.com/repos/octo-org/octo-repo/stargazers",
100+
"contributors_url": "https://api.github.com/repos/octo-org/octo-repo/contributors",
101+
"subscribers_url": "https://api.github.com/repos/octo-org/octo-repo/subscribers",
102+
"subscription_url": "https://api.github.com/repos/octo-org/octo-repo/subscription",
103+
"commits_url": "https://api.github.com/repos/octo-org/octo-repo/commits{/sha}",
104+
"git_commits_url": "https://api.github.com/repos/octo-org/octo-repo/git/commits{/sha}",
105+
"comments_url": "https://api.github.com/repos/octo-org/octo-repo/comments{/number}",
106+
"issue_comment_url": "https://api.github.com/repos/octo-org/octo-repo/issues/comments{/number}",
107+
"contents_url": "https://api.github.com/repos/octo-org/octo-repo/contents/{+path}",
108+
"compare_url": "https://api.github.com/repos/octo-org/octo-repo/compare/{base}...{head}",
109+
"merges_url": "https://api.github.com/repos/octo-org/octo-repo/merges",
110+
"archive_url": "https://api.github.com/repos/octo-org/octo-repo/{archive_format}{/ref}",
111+
"downloads_url": "https://api.github.com/repos/octo-org/octo-repo/downloads",
112+
"issues_url": "https://api.github.com/repos/octo-org/octo-repo/issues{/number}",
113+
"pulls_url": "https://api.github.com/repos/octo-org/octo-repo/pulls{/number}",
114+
"milestones_url": "https://api.github.com/repos/octo-org/octo-repo/milestones{/number}",
115+
"notifications_url": "https://api.github.com/repos/octo-org/octo-repo/notifications{?since,all,participating}",
116+
"labels_url": "https://api.github.com/repos/octo-org/octo-repo/labels{/name}",
117+
"releases_url": "https://api.github.com/repos/octo-org/octo-repo/releases{/id}",
118+
"deployments_url": "https://api.github.com/repos/octo-org/octo-repo/deployments",
119+
"created_at": "2014-02-28T02:42:51Z",
120+
"updated_at": "2021-03-11T14:54:13Z",
121+
"pushed_at": "2021-03-11T14:54:10Z",
122+
"git_url": "git://github.com/octo-org/octo-repo.git",
123+
"ssh_url": "org-6811672@github.com:octo-org/octo-repo.git",
124+
"clone_url": "https://github.com/octo-org/octo-repo.git",
125+
"svn_url": "https://github.com/octo-org/octo-repo",
126+
"homepage": "",
127+
"size": 300,
128+
"stargazers_count": 0,
129+
"watchers_count": 0,
130+
"language": "JavaScript",
131+
"has_issues": true,
132+
"has_projects": false,
133+
"has_downloads": true,
134+
"has_wiki": false,
135+
"has_pages": true,
136+
"forks_count": 0,
137+
"mirror_url": null,
138+
"archived": false,
139+
"disabled": false,
140+
"open_issues_count": 39,
141+
"license": null,
142+
"forks": 0,
143+
"open_issues": 39,
144+
"watchers": 0,
145+
"default_branch": "main"
146+
},
147+
"organization": {
148+
"login": "octo-org",
149+
"id": 6811672,
150+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjY4MTE2NzI=",
151+
"url": "https://api.github.com/orgs/octo-org",
152+
"repos_url": "https://api.github.com/orgs/octo-org/repos",
153+
"events_url": "https://api.github.com/orgs/octo-org/events",
154+
"hooks_url": "https://api.github.com/orgs/octo-org/hooks",
155+
"issues_url": "https://api.github.com/orgs/octo-org/issues",
156+
"members_url": "https://api.github.com/orgs/octo-org/members{/member}",
157+
"public_members_url": "https://api.github.com/orgs/octo-org/public_members{/member}",
158+
"avatar_url": "https://avatars.githubusercontent.com/u/6811672?v=4",
159+
"description": "Working better together!"
160+
},
161+
"sender": {
162+
"login": "Codertocat",
163+
"id": 21031067,
164+
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
165+
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
166+
"gravatar_id": "",
167+
"url": "https://api.github.com/users/Codertocat",
168+
"html_url": "https://github.com/Codertocat",
169+
"followers_url": "https://api.github.com/users/Codertocat/followers",
170+
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
171+
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
172+
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
173+
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
174+
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
175+
"repos_url": "https://api.github.com/users/Codertocat/repos",
176+
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
177+
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
178+
"type": "User",
179+
"site_admin": false
180+
}
181+
}

0 commit comments

Comments
 (0)