Skip to content

Commit 31357e2

Browse files
docs: improve signed webhook event validation docs (#472)
1 parent 0e287cb commit 31357e2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

TROUBLESHOOTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ If you can't find a solution below, please open an [issue](https://github.com/se
1717
* [Rails Specifics](#rails-specifics)
1818
* [Ruby Versions](#ruby-versions)
1919
* [Viewing the Request Body](#viewing-the-request-body)
20+
* [Verifying Event Webhooks](#signed-webhooks)
2021

2122
<a name="migrating"></a>
2223
## Migrating from v2 to v3
@@ -137,3 +138,14 @@ You can do this before `response = sg.client.mail._('send').post(request_body: m
137138
```ruby
138139
puts mail.to_json
139140
```
141+
142+
<a name="signed-webhooks"></a>
143+
## Signed Webhook Verification
144+
145+
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-ruby library can help you verify these Signed Event Webhooks.
146+
147+
You can find the usage example [here](examples/helpers/eventwebhook/example.rb) and the tests [here](spec/sendgrid/helpers/eventwebhook/eventwebhook_spec.rb).
148+
If you are still having trouble getting the validation to work, follow the following instructions:
149+
- Be sure to use the *raw* payload for validation
150+
- Be sure to include a trailing carriage return and newline in your payload
151+
- In case of multi-event webhooks, make sure you include the trailing newline and carriage return after *each* event

0 commit comments

Comments
 (0)