Skip to content

Commit c4b5b14

Browse files
committed
feat(webhooks): support receiving notifications when responder is hit
1 parent 389711a commit c4b5b14

76 files changed

Lines changed: 1745 additions & 109 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.sqlx/query-4a56524f2e1fab5058a633da34182c78db5a9ce34446b4bfce4dcdf40db6b626.json

Lines changed: 80 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-512fc3e38bed42887daa081e2b954e975e95e4510f9e048f8205378b26603e42.json

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-5ef386623714a12b85bab97f0518705ccc4fa2017202209452a84f27034a457b.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-5f3d3e11f39309020c7e47c8ba857b9e0b614046ff99e7d4a9b5ff5b252f7432.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

.sqlx/query-c44fb4074956b9dd1a38c50cdd4dc15a722ace5a6a88b552e6e9b14dbc11502f.json

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-c8ef27f3d11c33a6e6b38928a2809ef693684ac66a00ca2e5d6b658a954f9b61.json

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>"{{responder_name}}" responder was hit</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
{{> email_styles}}
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>"{{responder_name}}" responder was hit</h1>
12+
<p>Your <b>"{{responder_name}}"</b> responder received <b>{{requests_label}}</b> since {{since}}.</p>
13+
<p>To review the tracked requests, visit the <b>Responders</b> page:</p>
14+
<a class="navigate-link" href="{{back_link}}">Webhooks → Responders</a>
15+
<p>If the button above doesn't work, you can navigate to the following URL directly: </p>
16+
<p>{{back_link}}</p>
17+
<a href="{{home_link}}"><img src="cid:secutils-logo" alt="Secutils.dev logo" width="89" height="14" /></a>
18+
{{#if unsubscribe_url}}
19+
<div class="email-footer">
20+
<p>You're receiving this email because Secutils.dev product notifications are enabled for this address.</p>
21+
<p><a href="{{unsubscribe_url}}">Unsubscribe</a></p>
22+
</div>
23+
{{/if}}
24+
</div>
25+
</body>
26+
</html>

components/secutils-docs/docs/guides/webhooks.mdx

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ In this guide, you'll create a responder that returns an HTML page with custom <
119119
},
120120
{
121121
img: '../img/docs/guides/webhooks/tracking_step2_form.png',
122-
caption: <>Enable <b>Advanced mode</b>, set <b>Tracking</b> to 5, and fill in the rest of the form. Click <b>Save</b>.<br/><br/>
122+
caption: <>Set <b>Tracking</b> to 5, and fill in the rest of the form. Click <b>Save</b>.<br/><br/>
123123
<SampleFields
124124
sample={honeypotResponderSample}
125125
entity="responders"
@@ -145,6 +145,41 @@ In this guide, you'll create a responder that returns an HTML page with custom <
145145
},
146146
]} />
147147

148+
## Get notified when a responder is hit
149+
150+
If you'd rather not poll the request history manually, you can ask Secutils.dev to email you when a responder receives requests. Because a responder is a public endpoint that can be hit at any rate, notifications are **coalesced**: instead of one email per request, you receive a single summary email per throttle window (for example, _at most once every hour_), telling you how many requests arrived since the last notification.
151+
152+
:::info NOTE
153+
154+
Notifications live under **Advanced mode**. They require **request tracking** to be enabled (`Tracking`, available in the standard settings, greater than zero), because the number of received requests is derived from the tracked request history - the toggle is hidden until tracking is enabled. Notifications are delivered to the email address associated with your account and carry an unsubscribe link, just like other Secutils.dev product notifications.
155+
156+
:::
157+
158+
<Steps steps={[
159+
{
160+
img: '../img/docs/guides/webhooks/notifications_step1_empty.png',
161+
caption: <>Navigate to <a href="https://secutils.dev/ws/webhooks__responders"><b>Webhooks → Responders</b></a> and click <strong>Create responder</strong>.</>,
162+
alt: 'Navigate to Webhooks → Responders and click Create responder.',
163+
},
164+
{
165+
img: '../img/docs/guides/webhooks/notifications_step2_form.png',
166+
caption: <>Make sure <b>Tracking</b> is greater than zero, enable <b>Advanced mode</b>, then turn on <b>Notifications</b> and pick how often you want to be emailed via <b>Notification frequency</b>. Click <b>Save</b>.<br/><br/>
167+
<table className="su-table">
168+
<tbody>
169+
<tr><td><b>Tracking</b></td><td><CodeBlock>10</CodeBlock></td></tr>
170+
<tr><td><b>Notifications</b></td><td><CodeBlock>Enabled</CodeBlock></td></tr>
171+
<tr><td><b>Notification frequency</b></td><td><CodeBlock>At most once every hour</CodeBlock></td></tr>
172+
</tbody>
173+
</table></>,
174+
alt: 'Enable Advanced mode, then enable notifications and choose a notification frequency for the responder.',
175+
},
176+
{
177+
img: '../img/docs/guides/webhooks/notifications_step3_created.png',
178+
caption: <>The responder appears in the grid with a <b>bell</b> icon indicating that email notifications are enabled.</>,
179+
alt: 'The responder row shows a bell icon when notifications are enabled.',
180+
},
181+
]} />
182+
148183
## Generate a dynamic response
149184

150185
In this guide, you'll build a responder that uses a custom JavaScript script to generate a dynamic response based on the request's query string parameter:
@@ -163,7 +198,7 @@ The script should be provided in the form of an [Immediately Invoked Function Ex
163198
},
164199
{
165200
img: '../img/docs/guides/webhooks/dynamic_step2_form.png',
166-
caption: <>Enable <b>Advanced mode</b>, set <b>Tracking</b> to 5, and fill in the form with a custom script.<br/><br/>
201+
caption: <>Set <b>Tracking</b> to 5, enable <b>Advanced mode</b> to access the <b>Script</b> field, and fill in the form with a custom script.<br/><br/>
167202
<SampleFields
168203
sample={dynamicResponderSample}
169204
entity="responders"
-179 Bytes
Loading
-439 Bytes
Loading

0 commit comments

Comments
 (0)