From 5e7d415aaf94afa874b8fb4c2a8f19e34b3b45d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:53:41 +0000 Subject: [PATCH 1/2] feat(deps): bump @seamapi/webhook from 1.0.0-rc.1 to 1.0.0 Bumps [@seamapi/webhook](https://github.com/seamapi/javascript-webhook) from 1.0.0-rc.1 to 1.0.0. - [Release notes](https://github.com/seamapi/javascript-webhook/releases) - [Changelog](https://github.com/seamapi/javascript-webhook/blob/main/.releaserc.json) - [Commits](https://github.com/seamapi/javascript-webhook/compare/v1.0.0-rc.1...v1.0.0) --- updated-dependencies: - dependency-name: "@seamapi/webhook" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0577204..9936ce3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@seamapi/http": "1.0.0-rc.1", "@seamapi/types": "1.184.0", - "@seamapi/webhook": "1.0.0-rc.1", + "@seamapi/webhook": "1.0.0", "seamapi-types": "1.42.0", "zod": "^3.21.4" }, @@ -1097,9 +1097,9 @@ } }, "node_modules/@seamapi/webhook": { - "version": "1.0.0-rc.1", - "resolved": "https://registry.npmjs.org/@seamapi/webhook/-/webhook-1.0.0-rc.1.tgz", - "integrity": "sha512-yFrbqB1o81/C9UmWCL0AUcTTajclx12O7HGWvrfxLwmTVE2/iiWgvFRCcGz/RVIAODr+5VsCzUH1JcRIDCM/6Q==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@seamapi/webhook/-/webhook-1.0.0.tgz", + "integrity": "sha512-lCLn1P8SVzEGRoJg2Jv33k5FRT8t5OYLYuVmNvzIVfQmBUG5yvc6cKheGt7ezqX4vGipURv07YH6iMUupQB4og==", "dependencies": { "svix": "^1.15.0" }, diff --git a/package.json b/package.json index e72327c..2337d1e 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "dependencies": { "@seamapi/http": "1.0.0-rc.1", "@seamapi/types": "1.184.0", - "@seamapi/webhook": "1.0.0-rc.1", + "@seamapi/webhook": "1.0.0", "seamapi-types": "1.42.0", "zod": "^3.21.4" }, From 1774122cea4d52d1cee6661876d90c5e9861bac1 Mon Sep 17 00:00:00 2001 From: Seam Bot Date: Mon, 17 Jun 2024 19:54:00 +0000 Subject: [PATCH 2/2] ci: Generate code --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 618793d..1bedc82 100644 --- a/README.md +++ b/README.md @@ -442,15 +442,15 @@ and obtain a Seam webhook secret. > This example is for [Express], 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' -import { storeEvent } from './store-event.js' - const app = express() -const webhook = new SeamWebhook(process.env.SEAM_WEBHOOK_SECRET) +const webhook = new SeamWebhook(env.SEAM_WEBHOOK_SECRET) app.post( '/webhook', @@ -458,11 +458,10 @@ app.post( (req, res) => { let data try { - data = webhook.verify(payload, headers) + data = webhook.verify(req.body, req.headers) } catch { return res.status(400).send() } - storeEvent(data, (err) => { if (err != null) { return res.status(500).send() @@ -471,6 +470,15 @@ app.post( }) }, ) + +const storeEvent = (data, callback) => { + console.log(data) + callback() +} + +app.listen(8080, () => { + console.log('Ready to receive webhooks at http://localhost:8080/webhook') +}) ``` [Express]: https://expressjs.com/