Skip to content

Commit fe25342

Browse files
docs: improve signed webhook event validation docs (#1134)
1 parent 21852f1 commit fe25342

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

TROUBLESHOOTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ If you can't find a solution below, please open an [issue](https://github.com/se
1919
* [Versioning Convention](#versioning)
2020
* [Viewing the Request Body](#request-body)
2121
* [UI requests are failing](#ui-requests)
22+
* [Verifying Event Webhooks](#signed-webhooks)
2223

2324
<a name="v2"></a>
2425
## Continue Using the v2 API
@@ -204,3 +205,14 @@ var response = await client.SendEmailAsync(msg).ConfigureAwait(false);
204205
If you are running a newer versions of .NET you can turn on a couple different Roslyn based analyzers that will trigger build errors if you're not calling `.ConfigureAwait(false)` on your async methods.
205206

206207
`Roslynator.Analyzers` can be installed through NuGet or as a VS plugin, but if you use the plugin then the analyzers won't run on build servers and trigger build errors as the NuGet package would. (thanks to [xt0rted](https://github.com/xt0rted) for this tip!)
208+
209+
<a name="signed-webhooks"></a>
210+
## Signed Webhook Verification
211+
212+
Twilio SendGrid's Event Webhook will notify a URL via HTTP POST with information about events that occur as your mail is processed. [This](https://docs.sendgrid.com/for-developers/tracking-events/getting-started-event-webhook-security-features) article covers all you need to know to secure the Event Webhook, allowing you to verify that incoming requests originate from Twilio SendGrid. The sendgrid-csharp library can help you verify these Signed Event Webhooks.
213+
214+
You can find the end-to-end usage example and the tests [here](examples/eventwebhook).
215+
If you are still having trouble getting the validation to work, follow the following instructions:
216+
- Be sure to use the *raw* payload for validation
217+
- Be sure to include a trailing carriage return and newline in your payload
218+
- In case of multi-event webhooks, make sure you include the trailing newline and carriage return after *each* event

USE_CASES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,4 +1087,4 @@ builder.Include(myScopes);
10871087
builder.Include("newsletter.read");
10881088
10891089
await client.CreateApiKey(builder, "Mail send, Alerts & Newletter read");
1090-
```
1090+
```

0 commit comments

Comments
 (0)