chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailBouncedOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Bounced Trigger
|
||||
* Triggers when an email permanently bounces.
|
||||
*/
|
||||
export const resendEmailBouncedTrigger: TriggerConfig = {
|
||||
id: 'resend_email_bounced',
|
||||
name: 'Resend Email Bounced',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when an email bounces',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_bounced',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('email.bounced'),
|
||||
extraFields: buildResendExtraFields('resend_email_bounced'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailBouncedOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailClickedOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Clicked Trigger
|
||||
* Triggers when a recipient clicks a link in an email.
|
||||
*/
|
||||
export const resendEmailClickedTrigger: TriggerConfig = {
|
||||
id: 'resend_email_clicked',
|
||||
name: 'Resend Email Clicked',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when a link in an email is clicked',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_clicked',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('email.clicked'),
|
||||
extraFields: buildResendExtraFields('resend_email_clicked'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailClickedOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailComplainedOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Complained Trigger
|
||||
* Triggers when a recipient marks an email as spam.
|
||||
*/
|
||||
export const resendEmailComplainedTrigger: TriggerConfig = {
|
||||
id: 'resend_email_complained',
|
||||
name: 'Resend Email Complained',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when an email is marked as spam',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_complained',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('email.complained'),
|
||||
extraFields: buildResendExtraFields('resend_email_complained'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailComplainedOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailDeliveredOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Delivered Trigger
|
||||
* Triggers when an email is successfully delivered to the recipient's mail server.
|
||||
*/
|
||||
export const resendEmailDeliveredTrigger: TriggerConfig = {
|
||||
id: 'resend_email_delivered',
|
||||
name: 'Resend Email Delivered',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when an email is delivered',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_delivered',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('email.delivered'),
|
||||
extraFields: buildResendExtraFields('resend_email_delivered'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailDeliveredOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailFailedOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Failed Trigger
|
||||
* Triggers when an email fails to send.
|
||||
*/
|
||||
export const resendEmailFailedTrigger: TriggerConfig = {
|
||||
id: 'resend_email_failed',
|
||||
name: 'Resend Email Failed',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when an email fails to send',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_failed',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('email.failed'),
|
||||
extraFields: buildResendExtraFields('resend_email_failed'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailFailedOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailOpenedOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Opened Trigger
|
||||
* Triggers when a recipient opens an email.
|
||||
*/
|
||||
export const resendEmailOpenedTrigger: TriggerConfig = {
|
||||
id: 'resend_email_opened',
|
||||
name: 'Resend Email Opened',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when an email is opened',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_opened',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('email.opened'),
|
||||
extraFields: buildResendExtraFields('resend_email_opened'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailOpenedOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildEmailSentOutputs,
|
||||
buildResendExtraFields,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Resend Email Sent Trigger
|
||||
* Triggers when an email is sent by Resend.
|
||||
*
|
||||
* This is the PRIMARY trigger - it includes the dropdown for selecting trigger type.
|
||||
*/
|
||||
export const resendEmailSentTrigger: TriggerConfig = {
|
||||
id: 'resend_email_sent',
|
||||
name: 'Resend Email Sent',
|
||||
provider: 'resend',
|
||||
description: 'Trigger workflow when an email is sent',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_email_sent',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
includeDropdown: true,
|
||||
setupInstructions: resendSetupInstructions('email.sent'),
|
||||
extraFields: buildResendExtraFields('resend_email_sent'),
|
||||
}),
|
||||
|
||||
outputs: buildEmailSentOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export { resendEmailBouncedTrigger } from './email_bounced'
|
||||
export { resendEmailClickedTrigger } from './email_clicked'
|
||||
export { resendEmailComplainedTrigger } from './email_complained'
|
||||
export { resendEmailDeliveredTrigger } from './email_delivered'
|
||||
export { resendEmailFailedTrigger } from './email_failed'
|
||||
export { resendEmailOpenedTrigger } from './email_opened'
|
||||
export { resendEmailSentTrigger } from './email_sent'
|
||||
export { resendWebhookTrigger } from './webhook'
|
||||
@@ -0,0 +1,259 @@
|
||||
import type { TriggerOutput } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Maps Sim Resend trigger IDs to a single Resend webhook event type.
|
||||
* Kept in sync with subscription registration in `resend` webhook provider.
|
||||
*/
|
||||
export const RESEND_TRIGGER_TO_EVENT_TYPE: Record<string, string> = {
|
||||
resend_email_sent: 'email.sent',
|
||||
resend_email_delivered: 'email.delivered',
|
||||
resend_email_bounced: 'email.bounced',
|
||||
resend_email_complained: 'email.complained',
|
||||
resend_email_opened: 'email.opened',
|
||||
resend_email_clicked: 'email.clicked',
|
||||
resend_email_failed: 'email.failed',
|
||||
}
|
||||
|
||||
/**
|
||||
* Event types registered for the catch-all `resend_webhook` trigger (API + matchEvent).
|
||||
*/
|
||||
export const RESEND_ALL_WEBHOOK_EVENT_TYPES: string[] = [
|
||||
'email.sent',
|
||||
'email.delivered',
|
||||
'email.delivery_delayed',
|
||||
'email.bounced',
|
||||
'email.complained',
|
||||
'email.opened',
|
||||
'email.clicked',
|
||||
'email.failed',
|
||||
'email.received',
|
||||
'email.scheduled',
|
||||
'email.suppressed',
|
||||
'contact.created',
|
||||
'contact.updated',
|
||||
'contact.deleted',
|
||||
'domain.created',
|
||||
'domain.updated',
|
||||
'domain.deleted',
|
||||
]
|
||||
|
||||
/**
|
||||
* Shared trigger dropdown options for all Resend triggers
|
||||
*/
|
||||
export const resendTriggerOptions = [
|
||||
{ label: 'Email Sent', id: 'resend_email_sent' },
|
||||
{ label: 'Email Delivered', id: 'resend_email_delivered' },
|
||||
{ label: 'Email Bounced', id: 'resend_email_bounced' },
|
||||
{ label: 'Email Complained', id: 'resend_email_complained' },
|
||||
{ label: 'Email Opened', id: 'resend_email_opened' },
|
||||
{ label: 'Email Clicked', id: 'resend_email_clicked' },
|
||||
{ label: 'Email Failed', id: 'resend_email_failed' },
|
||||
{ label: 'Generic Webhook (All Events)', id: 'resend_webhook' },
|
||||
]
|
||||
|
||||
/**
|
||||
* Generates setup instructions for Resend webhooks.
|
||||
* The webhook is automatically created in Resend when you save.
|
||||
*/
|
||||
export function resendSetupInstructions(eventType: string): string {
|
||||
const instructions = [
|
||||
'Enter your Resend API Key above.',
|
||||
'You can find your API key in Resend at <strong>Settings > API Keys</strong>. See the <a href="https://resend.com/docs/dashboard/api-keys/introduction" target="_blank" rel="noopener noreferrer">Resend API documentation</a> for details.',
|
||||
`Click <strong>"Save Configuration"</strong> to automatically create the webhook in Resend for <strong>${eventType}</strong> events.`,
|
||||
'The webhook will be automatically deleted when you remove this trigger.',
|
||||
]
|
||||
|
||||
return instructions
|
||||
.map(
|
||||
(instruction, index) =>
|
||||
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
|
||||
)
|
||||
.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to build Resend-specific extra fields.
|
||||
* Includes API key (required).
|
||||
* Use with the generic buildTriggerSubBlocks from @/triggers.
|
||||
*/
|
||||
export function buildResendExtraFields(triggerId: string) {
|
||||
return [
|
||||
{
|
||||
id: 'apiKey',
|
||||
title: 'API Key',
|
||||
type: 'short-input' as const,
|
||||
placeholder: 'Enter your Resend API key (re_...)',
|
||||
description: 'Required to create the webhook in Resend.',
|
||||
password: true,
|
||||
paramVisibility: 'user-only' as const,
|
||||
required: true,
|
||||
mode: 'trigger' as const,
|
||||
condition: { field: 'selectedTriggerId', value: triggerId },
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Common fields present in all Resend email webhook payloads
|
||||
* (see https://resend.com/docs/dashboard/webhooks/introduction — example `data` object).
|
||||
*/
|
||||
const commonEmailOutputs = {
|
||||
type: {
|
||||
type: 'string',
|
||||
description: 'Event type (e.g., email.sent, email.delivered)',
|
||||
},
|
||||
created_at: {
|
||||
type: 'string',
|
||||
description: 'Webhook event creation timestamp (ISO 8601), top-level `created_at`',
|
||||
},
|
||||
data_created_at: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Email record timestamp from payload `data.created_at` (ISO 8601), when present — distinct from top-level `created_at`',
|
||||
},
|
||||
email_id: {
|
||||
type: 'string',
|
||||
description: 'Unique email identifier',
|
||||
},
|
||||
broadcast_id: {
|
||||
type: 'string',
|
||||
description: 'Broadcast ID associated with the email, when sent as part of a broadcast',
|
||||
},
|
||||
template_id: {
|
||||
type: 'string',
|
||||
description: 'Template ID used to send the email, when applicable',
|
||||
},
|
||||
tags: {
|
||||
type: 'json',
|
||||
description: 'Tag key/value metadata attached to the email (payload `data.tags`)',
|
||||
},
|
||||
from: {
|
||||
type: 'string',
|
||||
description: 'Sender email address',
|
||||
},
|
||||
subject: {
|
||||
type: 'string',
|
||||
description: 'Email subject line',
|
||||
},
|
||||
} as const
|
||||
|
||||
/**
|
||||
* Recipient fields present in email webhook payloads
|
||||
*/
|
||||
const recipientOutputs = {
|
||||
to: {
|
||||
type: 'json',
|
||||
description: 'Array of recipient email addresses',
|
||||
},
|
||||
} as const
|
||||
|
||||
const resendEventDataOutput: Record<string, TriggerOutput> = {
|
||||
data: {
|
||||
type: 'json',
|
||||
description:
|
||||
'Raw event `data` from Resend (shape varies by event type: email, contact, domain, etc.)',
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email sent events
|
||||
*/
|
||||
export function buildEmailSentOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email delivered events
|
||||
*/
|
||||
export function buildEmailDeliveredOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email bounced events
|
||||
*/
|
||||
export function buildEmailBouncedOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
bounceType: { type: 'string', description: 'Bounce type (e.g., Permanent)' },
|
||||
bounceSubType: { type: 'string', description: 'Bounce sub-type (e.g., Suppressed)' },
|
||||
bounceMessage: { type: 'string', description: 'Bounce error message' },
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email complained events
|
||||
*/
|
||||
export function buildEmailComplainedOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email opened events
|
||||
*/
|
||||
export function buildEmailOpenedOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email clicked events
|
||||
*/
|
||||
export function buildEmailClickedOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
clickIpAddress: { type: 'string', description: 'IP address of the click' },
|
||||
clickLink: { type: 'string', description: 'URL that was clicked' },
|
||||
clickTimestamp: { type: 'string', description: 'Click timestamp (ISO 8601)' },
|
||||
clickUserAgent: { type: 'string', description: 'Browser user agent string' },
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for email failed events
|
||||
*/
|
||||
export function buildEmailFailedOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for generic webhook (all events).
|
||||
* Includes all possible fields across event types.
|
||||
*/
|
||||
export function buildResendOutputs(): Record<string, TriggerOutput> {
|
||||
return {
|
||||
...commonEmailOutputs,
|
||||
...recipientOutputs,
|
||||
...resendEventDataOutput,
|
||||
bounceType: { type: 'string', description: 'Bounce type (e.g., Permanent)' },
|
||||
bounceSubType: { type: 'string', description: 'Bounce sub-type (e.g., Suppressed)' },
|
||||
bounceMessage: { type: 'string', description: 'Bounce error message' },
|
||||
clickIpAddress: { type: 'string', description: 'IP address of the click' },
|
||||
clickLink: { type: 'string', description: 'URL that was clicked' },
|
||||
clickTimestamp: { type: 'string', description: 'Click timestamp (ISO 8601)' },
|
||||
clickUserAgent: { type: 'string', description: 'Browser user agent string' },
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { ResendIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildResendExtraFields,
|
||||
buildResendOutputs,
|
||||
resendSetupInstructions,
|
||||
resendTriggerOptions,
|
||||
} from '@/triggers/resend/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Generic Resend Webhook Trigger
|
||||
* Captures all Resend webhook events
|
||||
*/
|
||||
export const resendWebhookTrigger: TriggerConfig = {
|
||||
id: 'resend_webhook',
|
||||
name: 'Resend Webhook (All Events)',
|
||||
provider: 'resend',
|
||||
description:
|
||||
'Trigger on Resend webhook events we subscribe to (email lifecycle, contacts, domains—see Resend docs). Flattened email fields may be null for non-email events; use <code>data</code> for the full payload.',
|
||||
version: '1.0.0',
|
||||
icon: ResendIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'resend_webhook',
|
||||
triggerOptions: resendTriggerOptions,
|
||||
setupInstructions: resendSetupInstructions('All Events'),
|
||||
extraFields: buildResendExtraFields('resend_webhook'),
|
||||
}),
|
||||
|
||||
outputs: buildResendOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user