Skip to content
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"esbuild": "0.28.1",
"esbuild-wasm": "0.28.0",
"picocolors": "1.1.1",
"resend": "6.18.0"
"resend": "6.18.1"
},
"pkg": {
"scripts": [
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ allowBuilds:
esbuild: true
'@biomejs/biome': true
minimumReleaseAgeExclude:
- resend@6.18.0
- resend
13 changes: 7 additions & 6 deletions src/commands/webhooks/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ Events fire per-recipient: a batch email to 3 recipients generates 3 email.sent
resend webhooks create --endpoint https://... --events email.sent,email.delivered
resend webhooks create --endpoint https://... --events all

Available event types (17 total):
Email: email.sent, email.delivered, email.delivery_delayed, email.bounced,
email.complained, email.opened, email.clicked, email.failed,
email.scheduled, email.suppressed, email.received
Contact: contact.created, contact.updated, contact.deleted
Domain: domain.created, domain.updated, domain.deleted
Available event types (19 total):
Email: email.sent, email.delivered, email.delivery_delayed, email.bounced,
email.complained, email.opened, email.clicked, email.failed,
email.scheduled, email.suppressed, email.received
Contact: contact.created, contact.updated, contact.deleted
Domain: domain.created, domain.updated, domain.deleted
Suppression: suppression.added, suppression.removed

The signing_secret in the response is shown ONCE — save it immediately to verify
webhook payloads using Svix signature headers (svix-id, svix-timestamp, svix-signature).
Expand Down
13 changes: 7 additions & 6 deletions src/commands/webhooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ export const webhooksCommand = new Command('webhooks')
context: `Webhooks let you receive real-time event notifications from Resend at an HTTPS endpoint.
Payloads are signed with Svix headers for verification.

Event categories (17 total):
Email: email.sent, email.delivered, email.delivery_delayed, email.bounced,
email.complained, email.opened, email.clicked, email.failed,
email.scheduled, email.suppressed, email.received
Contact: contact.created, contact.updated, contact.deleted
Domain: domain.created, domain.updated, domain.deleted
Event categories (19 total):
Email: email.sent, email.delivered, email.delivery_delayed, email.bounced,
email.complained, email.opened, email.clicked, email.failed,
email.scheduled, email.suppressed, email.received
Contact: contact.created, contact.updated, contact.deleted
Domain: domain.created, domain.updated, domain.deleted
Suppression: suppression.added, suppression.removed

Signature verification (Svix):
Each delivery includes headers: svix-id, svix-timestamp, svix-signature
Expand Down
2 changes: 1 addition & 1 deletion src/commands/webhooks/listen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function summarizeEvent(body: Record<string, unknown>): {
}
} else if (type.startsWith('domain.')) {
detail = safeTerminalText((data.name as string) ?? '');
} else if (type.startsWith('contact.')) {
} else if (type.startsWith('contact.') || type.startsWith('suppression.')) {
detail = safeTerminalText((data.email as string) ?? '');
}

Expand Down
2 changes: 2 additions & 0 deletions src/commands/webhooks/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const ALL_WEBHOOK_EVENTS: WebhookEvent[] = [
'domain.created',
'domain.updated',
'domain.deleted',
'suppression.added',
'suppression.removed',
];

export function normalizeEvents(raw: string[]): string[] {
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/webhooks/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('webhooks create command', () => {
expect(args.events).toEqual(['email.sent', 'email.bounced']);
});

it('expands "all" shorthand to all 17 events', async () => {
it('expands "all" shorthand to all 19 events', async () => {
spies = setupOutputSpies();

const { createWebhookCommand } = await import(
Expand All @@ -95,7 +95,7 @@ describe('webhooks create command', () => {
);

const args = mockCreate.mock.calls[0][0] as Record<string, unknown>;
expect(args.events).toHaveLength(17);
expect(args.events).toHaveLength(19);
expect(args.events).toContain('email.sent');
expect(args.events).toContain('contact.created');
expect(args.events).toContain('domain.deleted');
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/webhooks/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('webhooks update command', () => {
expect(payload.events).toEqual(['email.sent', 'email.bounced']);
});

it('expands "all" shorthand in --events to 17 events', async () => {
it('expands "all" shorthand in --events to 19 events', async () => {
spies = setupOutputSpies();

const { updateWebhookCommand } = await import(
Expand All @@ -94,7 +94,7 @@ describe('webhooks update command', () => {
});

const payload = mockUpdate.mock.calls[0][1] as Record<string, unknown>;
expect(payload.events).toHaveLength(17);
expect(payload.events).toHaveLength(19);
});

it('updates status with --status flag', async () => {
Expand Down