Skip to content

Commit e5d5d33

Browse files
authored
Merge pull request #6518 from segmentio/samkcrespo-patch-16
Update index.md
2 parents 3dede91 + 75c180f commit e5d5d33

File tree

1 file changed

+18
-0
lines changed
  • src/connections/destinations/catalog/webhooks

1 file changed

+18
-0
lines changed

src/connections/destinations/catalog/webhooks/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,24 @@ if (signature === digest) {
217217
}
218218
```
219219

220+
For Batch events, the process to authenticate these requests slightly differs as it involves verifying the X-Signature header against a hash of the *first event* in the batch.
221+
222+
An example of how you might authenticate batch requests would be:
223+
224+
```javascript
225+
const signature = req.headers['x-signature'];
226+
const digest = crypto
227+
.createHmac('sha1', 'sharedsecretvalue')
228+
.update(JSON.stringify(req.body[0]),'utf-8')
229+
.digest('hex');
230+
231+
if (signature === digest) {
232+
233+
// do cool stuff
234+
235+
}
236+
```
237+
220238
### SSL Certification
221239

222240
If your server is using HTTPS, note that our webhooks destination does not work with self-signed certs. If webhooks detects a self-signed cert it will throw an error and no request will be sent.

0 commit comments

Comments
 (0)