Skip to content

Commit c7f7f48

Browse files
authored
chore: change webhook back to object (#7461)
1 parent e814248 commit c7f7f48

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.changeset/mean-jars-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
chore: data in webhook payload is an object

packages/service-utils/src/node/webhookProducer.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import assert from "node:assert";
22
import { createId } from "@paralleldrive/cuid2";
33
import type { KafkaProducer } from "./kafka.js";
44

5+
/**
6+
* The event schema for webhook events.
7+
* See more: https://github.com/thirdweb-dev/api-server/blob/dev/docs/webhooks.md
8+
*/
59
interface WebhookEvent extends Record<string, unknown> {
610
id?: `evt_${string}`;
711
teamId: string;
@@ -11,9 +15,9 @@ interface WebhookEvent extends Record<string, unknown> {
1115
*/
1216
createdAt?: Date;
1317
/**
14-
* An array of your model (defined in api-server). Must not be empty.
18+
* Your model defined in api-server.
1519
*/
16-
payload: Record<string, unknown>[];
20+
data: Record<string, unknown>;
1721
}
1822

1923
/**
@@ -42,7 +46,6 @@ export class WebhookEventProducer {
4246
*/
4347
async sendEvents(topic: string, events: WebhookEvent[]): Promise<void> {
4448
const parsedEvents: WebhookEvent[] = events.map((event) => {
45-
assert(event.payload.length > 0, "payload must not be empty");
4649
assert(
4750
event.teamId.startsWith("team_"),
4851
"teamId must start with 'team_'",

0 commit comments

Comments
 (0)