Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -953,13 +953,20 @@ Use it to parse and validate [Seam webhook events](https://docs.seam.co/latest/d
Refer to the [Svix docs on Consuming Webhooks](https://docs.svix.com/receiving/introduction)
for an in-depth guide on best-practices for handling webhooks in your application.

`new SeamWebhook()` reads `SEAM_WEBHOOK_SECRET` when set.
Otherwise, pass your webhook signing secret explicitly with `new SeamWebhook(secret)`.
An explicit secret takes precedence over the environment variable.

Verification failures throw Svix's `WebhookVerificationError`, re-exported as
`SeamWebhookVerificationError`.
A payload that is correctly signed but unreadable throws a `SeamInvalidWebhookPayloadError`.

```js
import { isSeamInvalidWebhookPayloadError, SeamWebhook } from 'seam'

const webhook = new SeamWebhook(secret)
let data

try {
data = webhook.verify(req.body, req.headers)
} catch (err) {
Expand All @@ -976,15 +983,13 @@ try {
> see the [Svix docs for more examples in specific frameworks](https://docs.svix.com/receiving/verifying-payloads/how).

```js
import { env } from 'node:process'

import { SeamWebhook } from 'seam'
import express from 'express'
import bodyParser from 'body-parser'

const app = express()

const webhook = new SeamWebhook(env.SEAM_WEBHOOK_SECRET)
const webhook = new SeamWebhook() // Uses SEAM_WEBHOOK_SECRET.

app.post(
'/webhook',
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
"packageManager": "[email protected]",
"dependencies": {
"@seamapi/cli": "0.60.0",
"@seamapi/http": "2.52.0",
"@seamapi/webhook": "1.5.0"
"@seamapi/http": "2.53.0",
"@seamapi/webhook": "1.6.0"
},
"devDependencies": {
"@types/node": "^24.10.9",
Expand Down
Loading