Skip to content

Commit 6a9ee69

Browse files
authored
Update UI screenshots and directions on outgoing webhooks (#12261)
Some edits and restructuring are included. - Refs #12127 <!-- readthedocs-preview docs start --> --- :books: Documentation previews :books: - User's documentation (`docs`): https://docs--12261.org.readthedocs.build/12261/ <!-- readthedocs-preview docs end --> <!-- readthedocs-preview dev start --> - Developer's documentation (`dev`): https://dev--12261.org.readthedocs.build/12261/ <!-- readthedocs-preview dev end -->
1 parent ad85c46 commit 6a9ee69

11 files changed

+135
-107
lines changed
-38.4 KB
Binary file not shown.
-107 KB
Binary file not shown.
-63.6 KB
Binary file not shown.
-54.3 KB
Binary file not shown.

docs/user/guides/build/index.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
How-to guides: build process
22
============================
33

4-
⏩️ :doc:`Setup email notifications </guides/build/email-notifications>`
4+
⏩️ :doc:`Set up email notifications </guides/build/email-notifications>`
55
Email notifications can alert you when your builds fail.
6-
This is the most simple way to monitor your documentation builds,
7-
it only requires you to switch it on.
6+
This is the most simple way to monitor your documentation builds.
87

9-
⏩️ :doc:`Setup webhook notifications </guides/build/webhooks>`
10-
Webhook notifications can alert you when your builds fail so you can take immediate action.
11-
We show examples of how to use the webhooks on popular platforms like Slack and Discord.
8+
⏩️ :doc:`/guides/build/webhooks`
9+
Outgoing webhooks can used to send updates on builds to other services.
10+
We show examples using webhooks to connect to popular platforms like Slack and Discord.
1211

1312
⏩️ :doc:`Configuring pull request builds </guides/pull-requests>`
1413
Have your documentation built and access a preview for every :doc:`pull request builds </pull-requests>`.
@@ -32,7 +31,7 @@ How-to guides: build process
3231
:hidden:
3332

3433
Setup email notifications </guides/build/email-notifications>
35-
Setup webhook notifications </guides/build/webhooks>
34+
/guides/build/webhooks
3635
Configuring pull request builds </guides/pull-requests>
3736
Using custom environment variables </guides/environment-variables>
3837
Managing versions automatically </guides/automation-rules>

docs/user/guides/build/webhooks.rst

Lines changed: 98 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
How to setup build status webhooks
2-
==================================
1+
Setting up outgoing webhooks
2+
============================
33

4-
In this guide,
5-
you can learn how to setup build notifications via webhooks.
6-
7-
When a documentation build is *triggered*, *successful* or *failed*,
8-
Read the Docs can notify external APIs using :term:`webhooks <webhook>`.
9-
In that way,
10-
you can receive build notifications in your own monitoring channels and be alerted you when your builds fail so you can take immediate action.
4+
When a project build is *triggered*, *successful* or *failed*,
5+
Read the Docs can notify external APIs using outgoing :term:`webhooks <webhook>`.
6+
These webhooks contain information about the build and build status
7+
and can allow an external service to use this information for alerting,
8+
monitoring, and many other custom configurations.
119

1210
.. seealso::
1311

@@ -17,25 +15,30 @@ you can receive build notifications in your own monitoring channels and be alert
1715
:doc:`/pull-requests`
1816
Configure automated feedback and documentation site previews for your pull requests.
1917

18+
.. note::
2019

21-
Build status webhooks
22-
---------------------
20+
:doc:`Builds for pull requests </pull-requests>` do not trigger outgoing :term:`webhooks <webhook>`.
2321

24-
Take these steps to enable build notifications using a webhook:
22+
Creating a new webhook
23+
----------------------
2524

26-
* Go to :menuselection:`Admin --> Webhooks` in your project.
27-
* Fill in the **URL** field and select what events will trigger the webhook
28-
* Modify the payload or leave the default (see below)
29-
* Click on :guilabel:`Save`
25+
To create a new outgoing webhook for your project:
3026

31-
.. figure:: /_static/images/webhooks-events.png
32-
:align: center
33-
:alt: URL and events for a webhook
27+
* Go to :menuselection:`Settings --> Outgoing webhooks` in your project.
28+
* Click :guilabel:`Add webhook`.
29+
* Fill in the :guilabel:`URL` field with the target URL for your endpoint.
30+
* Select the which events will trigger the webhook.
31+
* Modify the :guilabel:`JSON payload` field or leave the default (see below for more).
32+
* Click on :guilabel:`Add webhook`
33+
34+
.. figure:: /img/screenshots/community-project-webhook-create.png
35+
:align: center
36+
:alt: Form for creating a new webhook
3437

35-
URL and events for a webhook
38+
Form for creating a new webhook
3639

37-
Every time one of the checked events triggers,
38-
Read the Docs will send a POST request to your webhook URL.
40+
Every time one of the selected events trigger,
41+
Read the Docs will send a POST request to your webhook target URL.
3942
The default payload will look like this:
4043

4144
.. code-block:: json
@@ -52,34 +55,70 @@ The default payload will look like this:
5255
"docs_url": "https://docs.readthedocs.io/en/latest/"
5356
}
5457
55-
When a webhook is sent, a new entry will be added to the
56-
"Recent Activity" table. By clicking on each individual entry,
57-
you will see the server response, the webhook request, and the payload.
58+
When a webhook is sent, a new entry will be added to the :guilabel:`Recent activity` list.
59+
You can click on each entry to see the webhook request, response, and the request payload.
5860

59-
.. figure:: /_static/images/webhooks-activity.png
61+
.. figure:: /img/screenshots/community-project-webhook-activity.png
6062
:align: center
61-
:alt: Activity of a webhook
63+
:alt: Recent activity of a webhook
6264

63-
Activity of a webhook
65+
Recent activity of a webhook
6466

65-
.. note::
67+
Custom payloads
68+
---------------
6669

67-
We don't trigger :term:`webhooks <webhook>` on :doc:`builds from pull requests </pull-requests>`.
70+
You can customize the payload of the webhook to fit the expected structure of your target endpoint.
71+
The payload structure must be valid JSON but can contain any of our
72+
`payload variable substitutions <Payload variable reference>`_.
6873

74+
Variable substitutions
75+
~~~~~~~~~~~~~~~~~~~~~~
6976

70-
Custom payload examples
71-
~~~~~~~~~~~~~~~~~~~~~~~
77+
The following variable strings can be used in a custom payload to substitute information
78+
about the build and project in the webhook body.
7279

73-
You can customize the payload of the webhook to suit your needs,
74-
as long as it is valid JSON. Below you have a couple of examples,
75-
and in the following section you will find all the available variables.
80+
``{{ event }}``
81+
Event that triggered the webhook, one of ``build:triggered``, ``build:failed``, or ``build:passed``.
7682

77-
.. figure:: /_static/images/webhooks-payload.png
78-
:width: 80%
79-
:align: center
80-
:alt: Custom payload
83+
``{{ build.id }}``
84+
Build ID.
85+
86+
``{{ build.commit }}``
87+
Commit corresponding to the build, if present (otherwise ``""``).
88+
89+
``{{ build.url }}``
90+
URL of the build, for example ``https://app.readthedocs.org/projects/docs/builds/15173336/``.
91+
92+
``{{ build.docs_url }}``
93+
URL of the documentation corresponding to the build,
94+
for example ``https://docs.readthedocs.io/en/latest/``.
95+
96+
``{{ build.start_date }}``
97+
Start date of the build (UTC, ISO format), for example ``2021-11-03T16:23:14``.
98+
99+
``{{ organization.name }}``
100+
Organization name (Commercial only).
101+
102+
``{{ organization.slug }}``
103+
Organization slug (Commercial only).
104+
105+
``{{ project.slug }}``
106+
Project slug.
107+
108+
``{{ project.name }}``
109+
Project name.
110+
111+
``{{ project.url }}``
112+
URL of the project :term:`dashboard`.
113+
114+
``{{ version.slug }}``
115+
Version slug.
116+
117+
``{{ version.name }}``
118+
Version name.
81119

82-
Custom payload
120+
Examples
121+
~~~~~~~~
83122

84123
.. tabs::
85124

@@ -121,7 +160,8 @@ and in the following section you will find all the available variables.
121160
]
122161
}
123162
124-
More information on `the Slack Incoming Webhooks documentation <https://api.slack.com/messaging/webhooks>`_.
163+
.. seealso::
164+
`Slack Incoming Webhooks documentation <https://api.slack.com/messaging/webhooks>`_
125165

126166
.. tab:: Discord
127167

@@ -155,59 +195,17 @@ and in the following section you will find all the available variables.
155195
]
156196
}
157197
158-
More information on `the Discord webhooks documentation <https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>`_.
159-
160-
Variable substitutions reference
161-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162-
163-
``{{ event }}``
164-
Event that triggered the webhook, one of ``build:triggered``, ``build:failed``, or ``build:passed``.
165-
166-
``{{ build.id }}``
167-
Build ID.
168-
169-
``{{ build.commit }}``
170-
Commit corresponding to the build, if present (otherwise ``""``).
171-
172-
``{{ build.url }}``
173-
URL of the build, for example ``https://app.readthedocs.org/projects/docs/builds/15173336/``.
174-
175-
``{{ build.docs_url }}``
176-
URL of the documentation corresponding to the build,
177-
for example ``https://docs.readthedocs.io/en/latest/``.
178-
179-
``{{ build.start_date }}``
180-
Start date of the build (UTC, ISO format), for example ``2021-11-03T16:23:14``.
181-
182-
``{{ organization.name }}``
183-
Organization name (Commercial only).
184-
185-
``{{ organization.slug }}``
186-
Organization slug (Commercial only).
187-
188-
``{{ project.slug }}``
189-
Project slug.
190-
191-
``{{ project.name }}``
192-
Project name.
198+
.. seealso::
199+
`Discord webhooks documentation <https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks>`_
193200

194-
``{{ project.url }}``
195-
URL of the project :term:`dashboard`.
196-
197-
``{{ version.slug }}``
198-
Version slug.
199-
200-
``{{ version.name }}``
201-
Version name.
202-
203-
Validating the payload
204-
----------------------
201+
Verifying the payload
202+
---------------------
205203

206204
After you add a new webhook, Read the Docs will generate a secret key for it
207-
and uses it to generate a hash signature (HMAC-SHA256) for each payload
208-
that is included in the ``X-Hub-Signature`` header of the request.
205+
and use the key to generate a hash signature (HMAC-SHA256) for each payload.
206+
This signature is included in the ``X-Hub-Signature`` header of each request.
209207

210-
.. figure:: /_static/images/webhooks-secret.png
208+
.. figure:: /img/screenshots/community-project-webhook-secret.png
211209
:width: 80%
212210
:align: center
213211
:alt: Webhook secret
@@ -263,7 +261,7 @@ send a payload with the following structure:
263261
}
264262
265263
To migrate to the new webhooks and keep a similar structure,
266-
you can use this payload:
264+
you can use this as the webhook custom payload:
267265

268266
.. code-block:: json
269267
@@ -281,17 +279,18 @@ you can use this payload:
281279
Troubleshooting webhooks and payload discovery
282280
----------------------------------------------
283281

284-
You can use public tools to discover, inspect and test webhook
285-
integration. These tools act as catch-all endpoints for HTTP requests
282+
You can use public tools to discover, inspect, and test outgoing webhooks.
283+
These tools act as catch-all endpoints for HTTP requests
286284
and respond with a 200 OK HTTP status code. You can use these payloads
287285
to develop your webhook services. You should exercise caution when using
288286
these tools as you might be sending sensitive data to external tools.
289287

290288
These public tools include:
291289

292-
- `Beeceptor <https://beeceptor.com/webhook-integration/>`__ to create
293-
a temporary HTTPS endpoint and inspect incoming payloads. It lets you
294-
respond custom response code or messages from named HTTP mock server.
295-
- `Webhook Tester <https://webhook-test.com/>`__ to inspect and debug
296-
incoming payloads. It lets you inspect all incoming requests to it’s
297-
URL/bucket.
290+
`Beeceptor <https://beeceptor.com/webhook-integration/>`__
291+
Create a temporary HTTPS endpoint and inspect incoming payloads. It lets you
292+
respond custom response code or messages from named HTTP mock server.
293+
294+
`Webhook Tester <https://webhook-test.com/>`__
295+
Inspect and debug incoming payloads. It lets you inspect all incoming
296+
requests to it’s URL/bucket.

docs/user/img/screenshots/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SHOTSCRAPER=uvx --from shot-scraper shot-scraper
33
all: reqs screenshots
44

55
reqs: install auth-business.json auth-community.json
6-
screenshots: business
6+
screenshots: business community
77

88
clean:
99
-rm *.png
10.7 KB
Loading
37.6 KB
Loading
7.76 KB
Loading

0 commit comments

Comments
 (0)