webhooks changedmanaged-agents/webhooks
Nearest release: v2.1.318, published 4 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+7added
Lines−35removed
From line
135
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits16to this page, all time
The whole hunk
from line 135, old and new numbered
/
from line 135
135135
136136## Verify the signature
137137
138Every delivery carries the `webhook-id`, `webhook-timestamp`, and `webhook-signature` headers. Use the SDK’s `unwrap()` (csharp, go: `Unwrap()`) helper to verify the signature and parse the event in one step. It throws if the signature is invalid or the payload is more than 5 minutes old.
138Every delivery carries the `webhook-id`, `webhook-timestamp`, and `webhook-signature` headers. In every SDK except C#, use the `unwrap()` (csharp, go: `Unwrap()`) helper to verify the signature and parse the event in one step. It throws if the signature is invalid or the payload is more than 5 minutes old.
139139
140140Set `ANTHROPIC_WEBHOOK_SIGNING_KEY` to the `whsec_`-prefixed secret shown at endpoint creation.
141141
142<CodeGroup exclude="shell:cURL, shell:CLI">
142<CodeGroup exclude="shell:cURL, shell:CLI, csharp">
143143 ```python Python
144144 from flask import Flask, request
145145 import anthropic
146 import standardwebhooks # pip install "anthropic[webhooks]"
146147
147148 client = anthropic.Anthropic() # reads ANTHROPIC_WEBHOOK_SIGNING_KEY from env
148149 app = Flask(__name__)
from line 157
156157 request.get_data(as_text=True),
157158 headers=dict(request.headers),
158159 )
159 except Exception:
160 except standardwebhooks.WebhookVerificationError:
160161 return "invalid signature", 400
161162
162163 if event.data.type == "session.status_idled":
from line 197
196197 });
197198 ```
198199
199 ```csharp C#
200 using Anthropic;
201
202 var client = new AnthropicClient(); // reads ANTHROPIC_WEBHOOK_SIGNING_KEY from env
203 var app = WebApplication.Create(args);
204
205 app.MapPost("/webhook", async (HttpRequest request) =>
206 {
207 using var reader = new StreamReader(request.Body);
208 var body = await reader.ReadToEndAsync();
209 var headers = request.Headers.ToDictionary(header => header.Key, header => header.Value.ToString());
210
211 UnwrapWebhookEvent webhookEvent;
212 try
213 {
214 // Unwrap() throws if the signature is invalid or the payload is stale
215 webhookEvent = client.Beta.Webhooks.Unwrap(body, headers);
216 }
217 catch
218 {
219 return Results.BadRequest("invalid signature");
220 }
221
222 if (webhookEvent.Data.TryPickSessionStatusIdled(out var idled))
223 {
224 Console.WriteLine($"session idled: {idled.ID}");
225 }
226 // handle other event types
227
228 return Results.Ok();
229 });
230 ```
200 <CodeGroupItem language="C#">
201 The C# SDK does not have `Unwrap()`. Verify the signature with a [Standard Webhooks](https://www.standardwebhooks.com/) library, then deserialize the body into `UnwrapWebhookEvent`.
202 </CodeGroupItem>
231203
232204 ```go Go
233205 package main
No line in this hunk matches that.