AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(resend): add AI-ready actions for templates, segments, topics, webhooks and contact properties (#15555)
Kishan Parmar3f38a4a23cc4
diff --git a/bun.lock b/bun.lockindex 591d4289b96..4d71d889995 100644--- a/bun.lock+++ b/bun.lock@@ -7671,7 +7671,7 @@},"packages/pieces/community/resend": {"name": "@activepieces/piece-resend",- "version": "0.5.0",+ "version": "0.5.1","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",diff --git a/packages/pieces/community/resend/package.json b/packages/pieces/community/resend/package.jsonindex 595f223dc38..45f05c3660b 100644--- a/packages/pieces/community/resend/package.json+++ b/packages/pieces/community/resend/package.json@@ -1,6 +1,6 @@{"name": "@activepieces/piece-resend",- "version": "0.5.0",+ "version": "0.5.1","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {diff --git a/packages/pieces/community/resend/src/index.ts b/packages/pieces/community/resend/src/index.tsindex 97d5ce2d56e..4093d19ad75 100644--- a/packages/pieces/community/resend/src/index.ts+++ b/packages/pieces/community/resend/src/index.ts@@ -28,9 +28,42 @@ import { listBroadcasts } from './lib/actions/list-broadcasts.action';import { createBroadcast } from './lib/actions/create-broadcast.action';import { sendBroadcast } from './lib/actions/send-broadcast.action';import { deleteBroadcast } from './lib/actions/delete-broadcast.action';+import { getContact } from './lib/actions/get-contact.action';+import { addContactToSegment } from './lib/actions/add-contact-to-segment.action';+import { removeContactFromSegment } from './lib/actions/remove-contact-from-segment.action';+import { listContactSegments } from './lib/actions/list-contact-segments.action';+import { listContactTopics } from './lib/actions/list-contact-topics.action';+import { createContactProperty } from './lib/actions/create-contact-property.action';+import { getContactProperty } from './lib/actions/get-contact-property.action';+import { listContactProperties } from './lib/actions/list-contact-properties.action';+import { updateContactProperty } from './lib/actions/update-contact-property.action';+import { deleteContactProperty } from './lib/actions/delete-contact-property.action';+import { createSegment } from './lib/actions/create-segment.action';+import { getSegment } from './lib/actions/get-segment.action';+import { listSegments } from './lib/actions/list-segments.action';+import { deleteSegment } from './lib/actions/delete-segment.action';+import { createTopic } from './lib/actions/create-topic.action';+import { getTopic } from './lib/actions/get-topic.action';+import { listTopics } from './lib/actions/list-topics.action';+import { updateTopic } from './lib/actions/update-topic.action';+import { deleteTopic } from './lib/actions/delete-topic.action';+import { createTemplate } from './lib/actions/create-template.action';+import { getTemplate } from './lib/actions/get-template.action';+import { listTemplates } from './lib/actions/list-templates.action';+import { updateTemplate } from './lib/actions/update-template.action';+import { deleteTemplate } from './lib/actions/delete-template.action';+import { publishTemplate } from './lib/actions/publish-template.action';+import { duplicateTemplate } from './lib/actions/duplicate-template.action';+import { createWebhook } from './lib/actions/create-webhook.action';+import { getWebhook } from './lib/actions/get-webhook.action';+import { listWebhooks } from './lib/actions/list-webhooks.action';+import { updateWebhook } from './lib/actions/update-webhook.action';+import { deleteWebhook } from './lib/actions/delete-webhook.action';+import { getEmailAttachment } from './lib/actions/get-email-attachment.action';+import { listEmailAttachments } from './lib/actions/list-email-attachments.action';+import { listReceivedEmails } from './lib/actions/list-received-emails.action';import { emailBounced } from './lib/triggers/email-bounced.trigger';--const BASE_URL = 'https://api.resend.com';+import { RESEND_BASE_URL } from './lib/common/client';export const resendAuth = PieceAuth.SecretText({displayName: 'API Key',@@ -43,7 +76,7 @@ export const resendAuth = PieceAuth.SecretText({try {await httpClient.sendRequest({method: HttpMethod.GET,- url: `${BASE_URL}/api-keys`,+ url: `${RESEND_BASE_URL}/api-keys`,authentication: {type: AuthenticationType.BEARER_TOKEN,token: auth,@@ -67,7 +100,7 @@ export const resend = createPiece({displayName: 'Resend',description: 'The email API for developers',auth: resendAuth,- minimumSupportedRelease: '0.36.1',+ minimumSupportedRelease: '0.87.0',logoUrl: 'https://cdn.activepieces.com/pieces/resend.png',categories: [PieceCategory.COMMUNICATION],authors: ['Tosh94'],@@ -93,8 +126,42 @@ export const resend = createPiece({createBroadcast,sendBroadcast,deleteBroadcast,+ getContact,+ addContactToSegment,+ removeContactFromSegment,+ listContactSegments,+ listContactTopics,+ createContactProperty,+ getContactProperty,+ listContactProperties,+ updateContactProperty,+ deleteContactProperty,+ createSegment,+ getSegment,+ listSegments,+ deleteSegment,+ createTopic,+ getTopic,+ listTopics,+ updateTopic,+ deleteTopic,+ createTemplate,+ getTemplate,+ listTemplates,+ updateTemplate,+ deleteTemplate,+ publishTemplate,+ duplicateTemplate,+ createWebhook,+ getWebhook,+ listWebhooks,+ updateWebhook,+ deleteWebhook,+ getEmailAttachment,+ listEmailAttachments,+ listReceivedEmails,createCustomApiCallAction({- baseUrl: () => BASE_URL,+ baseUrl: () => RESEND_BASE_URL,auth: resendAuth,authMapping: async (auth) => ({Authorization: `Bearer ${(auth as { secret_text: string }).secret_text}`,diff --git a/packages/pieces/community/resend/src/lib/actions/add-contact-to-segment.action.ts b/packages/pieces/community/resend/src/lib/actions/add-contact-to-segment.action.tsnew file mode 100644index 00000000000..384971e9ad1--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/add-contact-to-segment.action.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { addContactToSegmentOutputSchema } from '../output-schemas';++export const addContactToSegment = createAction({+ name: 'add_contact_to_segment',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Add Contact To Segment',+ outputSchema: addContactToSegmentOutputSchema,+ description: 'Add a contact to a segment',+ audience: 'ai',+ aiMetadata: { description: 'Adds an existing contact (identified by ID or email) to a segment (identified by segment ID), for targeted broadcasts. Use List Segments to find the segment ID. Idempotent — adding a contact already in the segment leaves it unchanged.', idempotent: true },+ props: {+ contact_identifier: resendProps.contactIdentifier,+ segment_id: resendProps.segmentId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/contacts/${encodeURIComponent(propsValue.contact_identifier)}/segments/${propsValue.segment_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/cancel-scheduled-email.action.ts b/packages/pieces/community/resend/src/lib/actions/cancel-scheduled-email.action.tsindex f6740128966..93de8126b7e 100644--- a/packages/pieces/community/resend/src/lib/actions/cancel-scheduled-email.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/cancel-scheduled-email.action.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { cancelScheduledEmailOutputSchema } from '../output-schemas';export const cancelScheduledEmail = createAction({@@ -20,11 +21,6 @@ export const cancelScheduledEmail = createAction({}),},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.POST,- url: `https://api.resend.com/emails/${propsValue.email_id}/cancel`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/emails/${propsValue.email_id}/cancel` });},});diff --git a/packages/pieces/community/resend/src/lib/actions/create-audience.action.ts b/packages/pieces/community/resend/src/lib/actions/create-audience.action.tsindex 24879cbd3a4..195a500cbc4 100644--- a/packages/pieces/community/resend/src/lib/actions/create-audience.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/create-audience.action.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { createAudienceOutputSchema } from '../output-schemas';export const createAudience = createAction({@@ -20,17 +21,12 @@ export const createAudience = createAction({}),},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{object: string;id: string;name: string;created_at: string;- }>({- method: HttpMethod.POST,- url: 'https://api.resend.com/audiences',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body: { name: propsValue.name },- });- return response.body;+ }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/audiences', body: { name: propsValue.name } });+ return response;},});diff --git a/packages/pieces/community/resend/src/lib/actions/create-broadcast.action.ts b/packages/pieces/community/resend/src/lib/actions/create-broadcast.action.tsindex 1590a0ca8fd..a162d19d673 100644--- a/packages/pieces/community/resend/src/lib/actions/create-broadcast.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/create-broadcast.action.ts@@ -1,7 +1,8 @@import { createAction, Property } from '@activepieces/pieces-framework';import { createBroadcastOutputSchema } from '../output-schemas';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';export const createBroadcast = createAction({@@ -68,12 +69,6 @@ export const createBroadcast = createAction({if (propsValue.reply_to) body['reply_to'] = propsValue.reply_to;if (propsValue.preview_text) body['preview_text'] = propsValue.preview_text;- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.POST,- url: 'https://api.resend.com/broadcasts',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body,- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/broadcasts', body: body });},});diff --git a/packages/pieces/community/resend/src/lib/actions/create-contact-property.action.ts b/packages/pieces/community/resend/src/lib/actions/create-contact-property.action.tsnew file mode 100644index 00000000000..4fceb0e4d85--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/create-contact-property.action.ts@@ -0,0 +1,54 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { createContactPropertyOutputSchema } from '../output-schemas';++export const createContactProperty = createAction({+ name: 'create_contact_property',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Create Contact Property',+ outputSchema: createContactPropertyOutputSchema,+ description: 'Define a new custom field for contacts',+ audience: 'ai',+ aiMetadata: { description: 'Creates a new custom contact property (a typed field, e.g. "plan_tier") that can be set per contact account-wide. Use this before referencing the property on a contact or template variable. The key and type are immutable after creation. Not idempotent — each call creates a new property even if the key matches an existing one.', idempotent: false },+ props: {+ key: Property.ShortText({+ displayName: 'Key',+ description: 'Property name, up to 50 characters, alphanumeric and underscores only.',+ required: true,+ }),+ type: Property.StaticDropdown({+ displayName: 'Type',+ required: true,+ options: {+ options: [+ { label: 'String', value: 'string' },+ { label: 'Number', value: 'number' },+ ],+ },+ }),+ fallback_value: Property.ShortText({+ displayName: 'Fallback Value',+ description: 'Default value used when the property is not set on a contact. Must match the selected type.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const body: Record<string, unknown> = { key: propsValue.key, type: propsValue.type };+ if (propsValue.fallback_value !== undefined && propsValue.fallback_value !== '') {+ if (propsValue.type === 'number') {+ const parsed = Number(propsValue.fallback_value);+ if (!Number.isFinite(parsed)) {+ throw new Error(`Fallback Value must be a valid number, got "${propsValue.fallback_value}".`);+ }+ body['fallback_value'] = parsed;+ } else {+ body['fallback_value'] = propsValue.fallback_value;+ }+ }++ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/contact-properties', body: body });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/create-contact.action.ts b/packages/pieces/community/resend/src/lib/actions/create-contact.action.tsindex ff58fcb0b96..ae37a6da373 100644--- a/packages/pieces/community/resend/src/lib/actions/create-contact.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/create-contact.action.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { createContactOutputSchema } from '../output-schemas';@@ -31,12 +32,6 @@ export const createContact = createAction({if (propsValue.last_name) body['last_name'] = propsValue.last_name;if (propsValue.unsubscribed !== undefined) body['unsubscribed'] = propsValue.unsubscribed;- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.POST,- url: `https://api.resend.com/audiences/${propsValue.audience_id}/contacts`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body,- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/audiences/${propsValue.audience_id}/contacts`, body: body });},});diff --git a/packages/pieces/community/resend/src/lib/actions/create-domain.action.ts b/packages/pieces/community/resend/src/lib/actions/create-domain.action.tsindex 6bddd681b09..e14b1c5ff36 100644--- a/packages/pieces/community/resend/src/lib/actions/create-domain.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/create-domain.action.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { createDomainOutputSchema } from '../output-schemas';export const createDomain = createAction({@@ -36,7 +37,7 @@ export const createDomain = createAction({const body: Record<string, unknown> = { name: propsValue.name };if (propsValue.region) body['region'] = propsValue.region;- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{id: string;name: string;status: string;@@ -44,14 +45,9 @@ export const createDomain = createAction({created_at: string;capabilities: { sending: string; receiving: string };records: { record: string; name: string; type: string; value: string; status: string; ttl: string }[];- }>({- method: HttpMethod.POST,- url: 'https://api.resend.com/domains',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body,- });+ }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/domains', body: body });- const d = response.body;+ const d = response;return {id: d.id,name: d.name,diff --git a/packages/pieces/community/resend/src/lib/actions/create-segment.action.ts b/packages/pieces/community/resend/src/lib/actions/create-segment.action.tsnew file mode 100644index 00000000000..1686e417e4a--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/create-segment.action.ts@@ -0,0 +1,22 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { createSegmentOutputSchema } from '../output-schemas';++export const createSegment = createAction({+ name: 'create_segment',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Create Segment',+ outputSchema: createSegmentOutputSchema,+ description: 'Create a new segment for grouping contacts',+ audience: 'ai',+ aiMetadata: { description: 'Creates a new empty segment (a named group of contacts) and returns its ID. Use this before adding contacts to it with Add Contact To Segment, or before targeting it with a broadcast. Not idempotent — each call creates a new segment even if the name matches an existing one.', idempotent: false },+ props: {+ name: Property.ShortText({ displayName: 'Name', description: 'A label for this segment.', required: true }),+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; name: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/segments', body: { name: propsValue.name } });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/create-template.action.ts b/packages/pieces/community/resend/src/lib/actions/create-template.action.tsnew file mode 100644index 00000000000..4f1807fd2db--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/create-template.action.ts@@ -0,0 +1,47 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { createTemplateOutputSchema } from '../output-schemas';++export const createTemplate = createAction({+ name: 'create_template',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Create Template',+ outputSchema: createTemplateOutputSchema,+ description: 'Create a new reusable email template',+ audience: 'ai',+ aiMetadata: { description: 'Creates a new reusable email template from HTML (and optional plain text), returning its ID. The template starts as an unpublished draft — use Publish Template to make it available for sending. Not idempotent — each call creates a new template even if the name matches an existing one.', idempotent: false },+ props: {+ name: Property.ShortText({ displayName: 'Name', required: true }),+ html: Property.LongText({ displayName: 'HTML Body', required: true }),+ alias: Property.ShortText({+ displayName: 'Alias',+ description: 'Optional short alias that can be used instead of the template ID in other calls.',+ required: false,+ }),+ from: Property.ShortText({+ displayName: 'From',+ description: 'Default sender address. Must be from a verified domain.',+ required: false,+ }),+ subject: Property.ShortText({ displayName: 'Default Subject', required: false }),+ reply_to: Property.ShortText({ displayName: 'Reply To', required: false }),+ text: Property.LongText({+ displayName: 'Text Body',+ description: 'Plain text version. Auto-generated from the HTML body if left blank.',+ required: false,+ }),+ },+ async run({ auth, propsValue }) {+ const body: Record<string, unknown> = { name: propsValue.name, html: propsValue.html };+ if (propsValue.alias) body['alias'] = propsValue.alias;+ if (propsValue.from) body['from'] = propsValue.from;+ if (propsValue.subject) body['subject'] = propsValue.subject;+ if (propsValue.reply_to) body['reply_to'] = propsValue.reply_to;+ if (propsValue.text) body['text'] = propsValue.text;++ return await resendClient.sendRequest<{ id: string; object: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/templates', body: body });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/create-topic.action.ts b/packages/pieces/community/resend/src/lib/actions/create-topic.action.tsnew file mode 100644index 00000000000..352c4152f6e--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/create-topic.action.ts@@ -0,0 +1,60 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { createTopicOutputSchema } from '../output-schemas';++export const createTopic = createAction({+ name: 'create_topic',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Create Topic',+ outputSchema: createTopicOutputSchema,+ description: 'Create a new topic to segment audience preferences',+ audience: 'ai',+ aiMetadata: { description: 'Creates a new topic (an opt-in/opt-out subscription category shown on the unsubscribe page) and returns its ID. The default subscription state is permanent once set. Not idempotent — each call creates a new topic even if the name matches an existing one.', idempotent: false },+ props: {+ name: Property.ShortText({+ displayName: 'Name',+ description: 'Topic identifier, up to 50 characters.',+ required: true,+ }),+ default_subscription: Property.StaticDropdown({+ displayName: 'Default Subscription',+ description: 'Initial preference for new contacts. Cannot be changed after creation.',+ required: true,+ options: {+ options: [+ { label: 'Opted In', value: 'opt_in' },+ { label: 'Opted Out', value: 'opt_out' },+ ],+ },+ }),+ description: Property.LongText({+ displayName: 'Description',+ description: 'Explanation shown to contacts, up to 200 characters.',+ required: false,+ }),+ visibility: Property.StaticDropdown({+ displayName: 'Visibility',+ description: 'Whether all contacts or only opted-in contacts see this topic on the unsubscribe page. Defaults to private.',+ required: false,+ options: {+ options: [+ { label: 'Public', value: 'public' },+ { label: 'Private', value: 'private' },+ ],+ },+ }),+ },+ async run({ auth, propsValue }) {+ const body: Record<string, unknown> = {+ name: propsValue.name,+ default_subscription: propsValue.default_subscription,+ };+ if (propsValue.description) body['description'] = propsValue.description;+ if (propsValue.visibility) body['visibility'] = propsValue.visibility;++ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/topics', body: body });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/create-webhook.action.ts b/packages/pieces/community/resend/src/lib/actions/create-webhook.action.tsnew file mode 100644index 00000000000..adcaea06398--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/create-webhook.action.ts@@ -0,0 +1,31 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { createWebhookOutputSchema } from '../output-schemas';++export const createWebhook = createAction({+ name: 'create_webhook',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Create Webhook',+ outputSchema: createWebhookOutputSchema,+ description: 'Create a webhook subscription for Resend events',+ audience: 'ai',+ aiMetadata: { description: 'Creates a webhook that sends real-time notifications to an endpoint URL for the selected Resend event types, returning its ID and a signing secret used to verify payloads. Store the signing secret immediately — it is only returned once, at creation. Not idempotent — each call creates a new webhook.', idempotent: false },+ props: {+ endpoint: Property.ShortText({+ displayName: 'Endpoint URL',+ description: 'The URL Resend will send event payloads to.',+ required: true,+ }),+ events: Property.Array({+ displayName: 'Events',+ description: 'Event types to subscribe to, e.g. email.sent, email.bounced, contact.created.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; signing_secret: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: '/webhooks', body: { endpoint: propsValue.endpoint, events: propsValue.events as string[] } });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-audience.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-audience.action.tsindex e1bdb02bd51..e60bd63c00c 100644--- a/packages/pieces/community/resend/src/lib/actions/delete-audience.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/delete-audience.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { deleteAudienceOutputSchema } from '../output-schemas';@@ -17,11 +18,6 @@ export const deleteAudience = createAction({audience_id: resendProps.audienceId,},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{ object: string; id: string; deleted: boolean }>({- method: HttpMethod.DELETE,- url: `https://api.resend.com/audiences/${propsValue.audience_id}`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/audiences/${propsValue.audience_id}` });},});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-broadcast.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-broadcast.action.tsindex d612928cbbf..56e7ecd6e42 100644--- a/packages/pieces/community/resend/src/lib/actions/delete-broadcast.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/delete-broadcast.action.ts@@ -1,7 +1,8 @@import { createAction } from '@activepieces/pieces-framework';import { deleteBroadcastOutputSchema } from '../output-schemas';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';export const deleteBroadcast = createAction({@@ -17,11 +18,6 @@ export const deleteBroadcast = createAction({broadcast_id: resendProps.broadcastId,},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{ object: string; id: string; deleted: boolean }>({- method: HttpMethod.DELETE,- url: `https://api.resend.com/broadcasts/${propsValue.broadcast_id}`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/broadcasts/${propsValue.broadcast_id}` });},});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-contact-property.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-contact-property.action.tsnew file mode 100644index 00000000000..b3bcc88e475--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/delete-contact-property.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { deleteContactPropertyOutputSchema } from '../output-schemas';++export const deleteContactProperty = createAction({+ name: 'delete_contact_property',+ classification: 'DESTRUCTIVE',+ auth: resendAuth,+ displayName: 'Delete Contact Property',+ outputSchema: deleteContactPropertyOutputSchema,+ description: 'Permanently remove a custom contact field',+ audience: 'ai',+ aiMetadata: { description: 'Permanently deletes a custom contact property, identified by ID. Removing it clears its value from every contact that had it set. Effectively idempotent — once deleted, repeating the call has no further effect.', idempotent: true },+ props: {+ contact_property_id: resendProps.contactPropertyId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/contact-properties/${propsValue.contact_property_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-contact.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-contact.action.tsindex e369d34ac61..561cac4afd2 100644--- a/packages/pieces/community/resend/src/lib/actions/delete-contact.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/delete-contact.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { deleteContactOutputSchema } from '../output-schemas';@@ -18,15 +19,11 @@ export const deleteContact = createAction({contact_id: resendProps.contactId,},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{object: string;contact: string;deleted: boolean;- }>({- method: HttpMethod.DELETE,- url: `https://api.resend.com/audiences/${propsValue.audience_id}/contacts/${propsValue.contact_id}`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body;+ }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/audiences/${propsValue.audience_id}/contacts/${propsValue.contact_id}` });+ return response;},});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-domain.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-domain.action.tsindex 8aa9f80b81b..dfe259b5513 100644--- a/packages/pieces/community/resend/src/lib/actions/delete-domain.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/delete-domain.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { deleteDomainOutputSchema } from '../output-schemas';@@ -17,11 +18,6 @@ export const deleteDomain = createAction({domain_id: resendProps.domainId,},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{ object: string; id: string; deleted: boolean }>({- method: HttpMethod.DELETE,- url: `https://api.resend.com/domains/${propsValue.domain_id}`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/domains/${propsValue.domain_id}` });},});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-segment.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-segment.action.tsnew file mode 100644index 00000000000..fc7002a8bdc--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/delete-segment.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { deleteSegmentOutputSchema } from '../output-schemas';++export const deleteSegment = createAction({+ name: 'delete_segment',+ classification: 'DESTRUCTIVE',+ auth: resendAuth,+ displayName: 'Delete Segment',+ outputSchema: deleteSegmentOutputSchema,+ description: 'Permanently delete a segment',+ audience: 'ai',+ aiMetadata: { description: 'Permanently deletes a segment by its ID; contacts themselves are not deleted, only their membership in this segment. Effectively idempotent — once deleted, repeating the call has no further effect.', idempotent: true },+ props: {+ segment_id: resendProps.segmentId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/segments/${propsValue.segment_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-template.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-template.action.tsnew file mode 100644index 00000000000..3d924e824f6--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/delete-template.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { deleteTemplateOutputSchema } from '../output-schemas';++export const deleteTemplate = createAction({+ name: 'delete_template',+ classification: 'DESTRUCTIVE',+ auth: resendAuth,+ displayName: 'Delete Template',+ outputSchema: deleteTemplateOutputSchema,+ description: 'Permanently remove an email template',+ audience: 'ai',+ aiMetadata: { description: 'Permanently deletes an email template, identified by ID or alias. Effectively idempotent — once deleted, repeating the call has no further effect.', idempotent: true },+ props: {+ template_id: resendProps.templateId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/templates/${propsValue.template_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-topic.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-topic.action.tsnew file mode 100644index 00000000000..77ba47d1671--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/delete-topic.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { deleteTopicOutputSchema } from '../output-schemas';++export const deleteTopic = createAction({+ name: 'delete_topic',+ classification: 'DESTRUCTIVE',+ auth: resendAuth,+ displayName: 'Delete Topic',+ outputSchema: deleteTopicOutputSchema,+ description: 'Permanently delete a topic',+ audience: 'ai',+ aiMetadata: { description: "Permanently deletes a topic by its ID, removing every contact's subscription state for it. Effectively idempotent — once deleted, repeating the call has no further effect.", idempotent: true },+ props: {+ topic_id: resendProps.topicId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/topics/${propsValue.topic_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/delete-webhook.action.ts b/packages/pieces/community/resend/src/lib/actions/delete-webhook.action.tsnew file mode 100644index 00000000000..36cc2deb7a9--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/delete-webhook.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { deleteWebhookOutputSchema } from '../output-schemas';++export const deleteWebhook = createAction({+ name: 'delete_webhook',+ classification: 'DESTRUCTIVE',+ auth: resendAuth,+ displayName: 'Delete Webhook',+ outputSchema: deleteWebhookOutputSchema,+ description: 'Permanently remove a webhook subscription',+ audience: 'ai',+ aiMetadata: { description: 'Permanently deletes a webhook, identified by ID, stopping all further event deliveries to its endpoint. Effectively idempotent — once deleted, repeating the call has no further effect.', idempotent: true },+ props: {+ webhook_id: resendProps.webhookId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/webhooks/${propsValue.webhook_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/duplicate-template.action.ts b/packages/pieces/community/resend/src/lib/actions/duplicate-template.action.tsnew file mode 100644index 00000000000..43d235981b9--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/duplicate-template.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { duplicateTemplateOutputSchema } from '../output-schemas';++export const duplicateTemplate = createAction({+ name: 'duplicate_template',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Duplicate Template',+ outputSchema: duplicateTemplateOutputSchema,+ description: 'Create a copy of an existing template',+ audience: 'ai',+ aiMetadata: { description: "Creates a new template that is a copy of an existing one, identified by ID or alias, and returns the new template's ID. Use this to start a variant of an existing template without modifying the original. Not idempotent — each call creates a new duplicate.", idempotent: false },+ props: {+ template_id: resendProps.templateId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/templates/${propsValue.template_id}/duplicate` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-contact-property.action.ts b/packages/pieces/community/resend/src/lib/actions/get-contact-property.action.tsnew file mode 100644index 00000000000..add6fc7a35e--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-contact-property.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { getContactPropertyOutputSchema } from '../output-schemas';++export const getContactProperty = createAction({+ name: 'get_contact_property',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Contact Property',+ outputSchema: getContactPropertyOutputSchema,+ description: 'Retrieve a single custom contact field by ID',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves the definition (key, type, fallback value) of a single custom contact property by its ID. Use List Contact Properties to find the ID. Read-only and idempotent.', idempotent: true },+ props: {+ contact_property_id: resendProps.contactPropertyId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/contact-properties/${propsValue.contact_property_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-contact.action.ts b/packages/pieces/community/resend/src/lib/actions/get-contact.action.tsnew file mode 100644index 00000000000..d611c18c677--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-contact.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { getContactOutputSchema } from '../output-schemas';++export const getContact = createAction({+ name: 'get_contact',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Contact',+ outputSchema: getContactOutputSchema,+ description: 'Retrieve a single contact by ID or email, across all audiences',+ audience: 'ai',+ aiMetadata: { description: "Looks up a single contact account-wide by Resend contact ID or email address, without needing to know which audience they belong to. Use this to check a contact's subscription status or custom properties before sending or updating. Read-only and idempotent.", idempotent: true },+ props: {+ contact_identifier: resendProps.contactIdentifier,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/contacts/${encodeURIComponent(propsValue.contact_identifier)}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-email-attachment.action.ts b/packages/pieces/community/resend/src/lib/actions/get-email-attachment.action.tsnew file mode 100644index 00000000000..341ae5d7794--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-email-attachment.action.ts@@ -0,0 +1,27 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { getEmailAttachmentOutputSchema } from '../output-schemas';++export const getEmailAttachment = createAction({+ name: 'get_email_attachment',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Email Attachment',+ outputSchema: getEmailAttachmentOutputSchema,+ description: 'Retrieve a single attachment from a sent email',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves metadata and a download URL for a single attachment on a previously sent email, identified by email ID and attachment ID. Use List Email Attachments to find the attachment ID. Read-only and idempotent; the download URL expires after a limited time.', idempotent: true },+ props: {+ email_id: Property.ShortText({+ displayName: 'Email ID',+ description: 'The ID of the sent email. Obtain from Get Email Status or List Sent Emails.',+ required: true,+ }),+ attachment_id: Property.ShortText({ displayName: 'Attachment ID', required: true }),+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/emails/${propsValue.email_id}/attachments/${propsValue.attachment_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-email-status.action.ts b/packages/pieces/community/resend/src/lib/actions/get-email-status.action.tsindex 26188f9f1c0..f8481b5849d 100644--- a/packages/pieces/community/resend/src/lib/actions/get-email-status.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/get-email-status.action.ts@@ -1,10 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import {- AuthenticationType,- HttpMethod,- httpClient,-} from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { getEmailStatusOutputSchema } from '../output-schemas';export const getEmailStatus = createAction({@@ -24,14 +21,6 @@ export const getEmailStatus = createAction({}),},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest({- method: HttpMethod.GET,- url: `https://api.resend.com/emails/${propsValue.email_id}`,- authentication: {- type: AuthenticationType.BEARER_TOKEN,- token: auth.secret_text,- },- });- return response.body;+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/emails/${propsValue.email_id}` });},});diff --git a/packages/pieces/community/resend/src/lib/actions/get-segment.action.ts b/packages/pieces/community/resend/src/lib/actions/get-segment.action.tsnew file mode 100644index 00000000000..8fec32110a1--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-segment.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { getSegmentOutputSchema } from '../output-schemas';++export const getSegment = createAction({+ name: 'get_segment',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Segment',+ outputSchema: getSegmentOutputSchema,+ description: 'Retrieve a single segment by its ID',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves the name and creation date of a single segment by its ID. Use List Segments to find the ID. Read-only and idempotent.', idempotent: true },+ props: {+ segment_id: resendProps.segmentId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/segments/${propsValue.segment_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-template.action.ts b/packages/pieces/community/resend/src/lib/actions/get-template.action.tsnew file mode 100644index 00000000000..3a16826e059--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-template.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { getTemplateOutputSchema } from '../output-schemas';++export const getTemplate = createAction({+ name: 'get_template',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Template',+ outputSchema: getTemplateOutputSchema,+ description: 'Retrieve a single template by ID or alias',+ audience: 'ai',+ aiMetadata: { description: "Retrieves the full content and metadata of a single email template, by ID or alias, including its HTML/text body and whether it has unpublished changes. Use List Templates to find the ID. Read-only and idempotent.", idempotent: true },+ props: {+ template_id: resendProps.templateId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/templates/${propsValue.template_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-topic.action.ts b/packages/pieces/community/resend/src/lib/actions/get-topic.action.tsnew file mode 100644index 00000000000..f11632f2d82--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-topic.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { getTopicOutputSchema } from '../output-schemas';++export const getTopic = createAction({+ name: 'get_topic',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Topic',+ outputSchema: getTopicOutputSchema,+ description: 'Retrieve a single topic by its ID',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves the full details of a single topic (name, description, default subscription, visibility) by its ID. Use List Topics to find the ID. Read-only and idempotent.', idempotent: true },+ props: {+ topic_id: resendProps.topicId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/topics/${propsValue.topic_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/get-webhook.action.ts b/packages/pieces/community/resend/src/lib/actions/get-webhook.action.tsnew file mode 100644index 00000000000..229f8330462--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/get-webhook.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { getWebhookOutputSchema } from '../output-schemas';++export const getWebhook = createAction({+ name: 'get_webhook',+ classification: 'READ',+ auth: resendAuth,+ displayName: 'Get Webhook',+ outputSchema: getWebhookOutputSchema,+ description: 'Retrieve a single webhook by its ID',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves the endpoint URL, status, and subscribed event types of a single webhook by its ID. Use List Webhooks to find the ID. Read-only and idempotent.', idempotent: true },+ props: {+ webhook_id: resendProps.webhookId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest({ auth: auth.secret_text, method: HttpMethod.GET, path: `/webhooks/${propsValue.webhook_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-audiences.action.ts b/packages/pieces/community/resend/src/lib/actions/list-audiences.action.tsindex 22691a8db1d..04a5fdfdbdd 100644--- a/packages/pieces/community/resend/src/lib/actions/list-audiences.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/list-audiences.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { listAudiencesOutputSchema } from '../output-schemas';export const listAudiences = createAction({@@ -14,13 +15,9 @@ export const listAudiences = createAction({aiMetadata: { description: 'Retrieves all contact audiences (mailing lists) in the connected Resend account, including each audience\'s ID and name. Use this to discover an audience ID needed by contact and broadcast actions (e.g. Create Contact, List Contacts, Create Broadcast). Read-only and idempotent.', idempotent: true },props: {},async run({ auth }) {- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{data: { id: string; name: string; created_at: string }[];- }>({- method: HttpMethod.GET,- url: 'https://api.resend.com/audiences',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body.data;+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/audiences' });+ return response.data;},});diff --git a/packages/pieces/community/resend/src/lib/actions/list-broadcasts.action.ts b/packages/pieces/community/resend/src/lib/actions/list-broadcasts.action.tsindex 2e9c271a50f..c1852a0b6fa 100644--- a/packages/pieces/community/resend/src/lib/actions/list-broadcasts.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/list-broadcasts.action.ts@@ -1,8 +1,9 @@import { createAction } from '@activepieces/pieces-framework';import { listBroadcastsOutputSchema } from '../output-schemas';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';interface BroadcastRecord {id: string;name: string;@@ -28,12 +29,8 @@ export const listBroadcasts = createAction({aiMetadata: { description: 'Retrieves all broadcast campaigns in the connected Resend account, including each broadcast\'s ID, name, audience, subject, and status (draft, scheduled, sent). Use this to find a broadcast ID (e.g. for Send Broadcast or Delete Broadcast) or to check campaign status. Read-only and idempotent.', idempotent: true },props: {},async run({ auth }) {- const response = await httpClient.sendRequest<{ data: BroadcastRecord[] }>({- method: HttpMethod.GET,- url: 'https://api.resend.com/broadcasts',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body.data.map((b) => ({+ const response = await resendClient.sendRequest<{ data: BroadcastRecord[] }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/broadcasts' });+ return response.data.map((b) => ({id: b.id,name: b.name ?? '',audience_id: b.audience_id,diff --git a/packages/pieces/community/resend/src/lib/actions/list-contact-properties.action.ts b/packages/pieces/community/resend/src/lib/actions/list-contact-properties.action.tsnew file mode 100644index 00000000000..4eb33e15e5b--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-contact-properties.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listContactPropertiesOutputSchema } from '../output-schemas';++export const listContactProperties = createAction({+ name: 'list_contact_properties',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Contact Properties',+ outputSchema: listContactPropertiesOutputSchema,+ description: 'Retrieve all custom contact fields defined on the account',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves every custom contact property defined on the account, including each one\'s key, type, and fallback value. Use this to discover a property ID (e.g. for Update or Delete Contact Property) or to check what custom fields exist before creating a new one. Read-only and idempotent.', idempotent: true },+ props: {},+ async run({ auth }) {+ const response = await resendClient.sendRequest<{+ data: { id: string; key: string; type: string; fallback_value?: string; created_at: string }[];+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/contact-properties' });+ return response.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-contact-segments.action.ts b/packages/pieces/community/resend/src/lib/actions/list-contact-segments.action.tsnew file mode 100644index 00000000000..8a115c60012--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-contact-segments.action.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { listContactSegmentsOutputSchema } from '../output-schemas';++export const listContactSegments = createAction({+ name: 'list_contact_segments',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Contact Segments',+ outputSchema: listContactSegmentsOutputSchema,+ description: 'List the segments a contact belongs to',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves every segment a contact (identified by ID or email) currently belongs to. Use this to check segment membership before adding or removing a contact from a segment. Read-only and idempotent.', idempotent: true },+ props: {+ contact_identifier: resendProps.contactIdentifier,+ },+ async run({ auth, propsValue }) {+ const result = await resendClient.sendRequest<{ data: { id: string; name: string; created_at: string }[] }>({ auth: auth.secret_text, method: HttpMethod.GET, path: `/contacts/${encodeURIComponent(propsValue.contact_identifier)}/segments` });+ return result.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-contact-topics.action.ts b/packages/pieces/community/resend/src/lib/actions/list-contact-topics.action.tsnew file mode 100644index 00000000000..7cb57280837--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-contact-topics.action.ts@@ -0,0 +1,26 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { listContactTopicsOutputSchema } from '../output-schemas';++export const listContactTopics = createAction({+ name: 'list_contact_topics',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Contact Topics',+ outputSchema: listContactTopicsOutputSchema,+ description: "List a contact's topic subscriptions",+ audience: 'ai',+ aiMetadata: { description: "Retrieves every topic a contact (identified by ID or email) is associated with, along with their opt-in/opt-out status for each. Use this to check a contact's topic preferences before sending topic-scoped broadcasts. Read-only and idempotent.", idempotent: true },+ props: {+ contact_identifier: resendProps.contactIdentifier,+ },+ async run({ auth, propsValue }) {+ const response = await resendClient.sendRequest<{+ data: { id: string; name: string; description: string; subscription: string }[];+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: `/contacts/${encodeURIComponent(propsValue.contact_identifier)}/topics` });+ return response.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-contacts.action.ts b/packages/pieces/community/resend/src/lib/actions/list-contacts.action.tsindex 79e31fce5a9..e7912f3c7e8 100644--- a/packages/pieces/community/resend/src/lib/actions/list-contacts.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/list-contacts.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { listContactsOutputSchema } from '../output-schemas';@@ -17,7 +18,7 @@ export const listContacts = createAction({audience_id: resendProps.audienceId,},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{data: {id: string;email: string;@@ -26,11 +27,7 @@ export const listContacts = createAction({created_at: string;unsubscribed: boolean;}[];- }>({- method: HttpMethod.GET,- url: `https://api.resend.com/audiences/${propsValue.audience_id}/contacts`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body.data;+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: `/audiences/${propsValue.audience_id}/contacts` });+ return response.data;},});diff --git a/packages/pieces/community/resend/src/lib/actions/list-domains.action.ts b/packages/pieces/community/resend/src/lib/actions/list-domains.action.tsindex a63ba754327..de9eceb3b51 100644--- a/packages/pieces/community/resend/src/lib/actions/list-domains.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/list-domains.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { listDomainsOutputSchema } from '../output-schemas';interface DomainRecord {@@ -23,12 +24,8 @@ export const listDomains = createAction({aiMetadata: { description: 'Retrieves all sending domains configured on the connected Resend account, including each domain\'s ID, name, verification status, and region. Use this to find a domain ID (e.g. for Verify Domain or Delete Domain) or to check which domains are verified before sending. Read-only and idempotent.', idempotent: true },props: {},async run({ auth }) {- const response = await httpClient.sendRequest<{ data: DomainRecord[] }>({- method: HttpMethod.GET,- url: 'https://api.resend.com/domains',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body.data.map((d) => ({+ const response = await resendClient.sendRequest<{ data: DomainRecord[] }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/domains' });+ return response.data.map((d) => ({id: d.id,name: d.name,status: d.status,diff --git a/packages/pieces/community/resend/src/lib/actions/list-email-attachments.action.ts b/packages/pieces/community/resend/src/lib/actions/list-email-attachments.action.tsnew file mode 100644index 00000000000..fd9b0f038f6--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-email-attachments.action.ts@@ -0,0 +1,36 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listEmailAttachmentsOutputSchema } from '../output-schemas';++export const listEmailAttachments = createAction({+ name: 'list_email_attachments',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Email Attachments',+ outputSchema: listEmailAttachmentsOutputSchema,+ description: 'Retrieve all attachments on a sent email',+ audience: 'ai',+ aiMetadata: { description: "Retrieves every attachment on a previously sent email, identified by email ID, including each one's filename, size, and a time-limited download URL. Read-only and idempotent.", idempotent: true },+ props: {+ email_id: Property.ShortText({+ displayName: 'Email ID',+ description: 'The ID of the sent email. Obtain from Get Email Status or List Sent Emails.',+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const response = await resendClient.sendRequest<{+ data: {+ id: string;+ filename: string;+ size: number;+ content_type: string;+ download_url: string;+ expires_at: string;+ }[];+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: `/emails/${propsValue.email_id}/attachments` });+ return response.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-emails.action.ts b/packages/pieces/community/resend/src/lib/actions/list-emails.action.tsindex 5648dfd7cfd..f740d2101da 100644--- a/packages/pieces/community/resend/src/lib/actions/list-emails.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/list-emails.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { listEmailsOutputSchema } from '../output-schemas';interface EmailRecord {@@ -27,12 +28,8 @@ export const listEmails = createAction({aiMetadata: { description: 'Retrieves the list of emails sent from the connected Resend account, including their IDs, recipients, subjects, and latest delivery event. Use this to discover email IDs (e.g. to feed Get Email Status, Cancel Scheduled Email, or Reschedule Email) or to audit recent sends. Read-only and idempotent.', idempotent: true },props: {},async run({ auth }) {- const response = await httpClient.sendRequest<{ data: EmailRecord[] }>({- method: HttpMethod.GET,- url: 'https://api.resend.com/emails',- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body.data.map((email) => ({+ const response = await resendClient.sendRequest<{ data: EmailRecord[] }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/emails' });+ return response.data.map((email) => ({id: email.id,from: email.from,to: (email.to ?? []).join(', '),diff --git a/packages/pieces/community/resend/src/lib/actions/list-received-emails.action.ts b/packages/pieces/community/resend/src/lib/actions/list-received-emails.action.tsnew file mode 100644index 00000000000..e89a1d9c22f--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-received-emails.action.ts@@ -0,0 +1,41 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listReceivedEmailsOutputSchema } from '../output-schemas';++interface ReceivedEmailRecord {+ id: string;+ to: string[] | null;+ from: string;+ created_at: string;+ subject: string;+ bcc: string[] | null;+ cc: string[] | null;+ reply_to: string[] | null;+}++export const listReceivedEmails = createAction({+ name: 'list_received_emails',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Received Emails',+ outputSchema: listReceivedEmailsOutputSchema,+ description: 'Retrieve emails received on an inbound domain',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves inbound emails received on a domain configured for receiving, including sender, recipients, and subject. Use this to check for and process incoming mail. Read-only and idempotent.', idempotent: true },+ props: {},+ async run({ auth }) {+ const response = await resendClient.sendRequest<{ data: ReceivedEmailRecord[] }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/emails/receiving' });+ return response.data.map((email) => ({+ id: email.id,+ from: email.from,+ to: (email.to ?? []).join(', '),+ subject: email.subject,+ created_at: email.created_at,+ cc: (email.cc ?? []).join(', '),+ bcc: (email.bcc ?? []).join(', '),+ reply_to: (email.reply_to ?? []).join(', '),+ }));+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-segments.action.ts b/packages/pieces/community/resend/src/lib/actions/list-segments.action.tsnew file mode 100644index 00000000000..90c258d3c04--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-segments.action.ts@@ -0,0 +1,21 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listSegmentsOutputSchema } from '../output-schemas';++export const listSegments = createAction({+ name: 'list_segments',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Segments',+ outputSchema: listSegmentsOutputSchema,+ description: 'Retrieve all segments in your Resend account',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves every segment defined on the account, including each one\'s ID and name. Use this to discover a segment ID (e.g. for Add Contact To Segment or targeting a broadcast) or to check whether a suitable segment already exists. Read-only and idempotent.', idempotent: true },+ props: {},+ async run({ auth }) {+ const result = await resendClient.sendRequest<{ data: { id: string; name: string; created_at: string }[] }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/segments' });+ return result.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-templates.action.ts b/packages/pieces/community/resend/src/lib/actions/list-templates.action.tsnew file mode 100644index 00000000000..bb03cf53cfa--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-templates.action.ts@@ -0,0 +1,31 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listTemplatesOutputSchema } from '../output-schemas';++export const listTemplates = createAction({+ name: 'list_templates',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Templates',+ outputSchema: listTemplatesOutputSchema,+ description: 'Retrieve all email templates in your Resend account',+ audience: 'ai',+ aiMetadata: { description: "Retrieves every email template defined on the account, including each one's status (draft or published) and alias. Use this to discover a template ID or check whether a suitable template already exists. Read-only and idempotent.", idempotent: true },+ props: {},+ async run({ auth }) {+ const response = await resendClient.sendRequest<{+ data: {+ id: string;+ name: string;+ status: string;+ published_at: string | null;+ created_at: string;+ updated_at: string;+ alias: string;+ }[];+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/templates' });+ return response.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-topics.action.ts b/packages/pieces/community/resend/src/lib/actions/list-topics.action.tsnew file mode 100644index 00000000000..de4f700f2fd--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-topics.action.ts@@ -0,0 +1,30 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listTopicsOutputSchema } from '../output-schemas';++export const listTopics = createAction({+ name: 'list_topics',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Topics',+ outputSchema: listTopicsOutputSchema,+ description: 'Retrieve all topics in your Resend account',+ audience: 'ai',+ aiMetadata: { description: 'Retrieves every topic defined on the account, including each one\'s name, description, default subscription, and visibility. Use this to discover a topic ID or to check whether a suitable topic already exists. Read-only and idempotent.', idempotent: true },+ props: {},+ async run({ auth }) {+ const response = await resendClient.sendRequest<{+ data: {+ id: string;+ name: string;+ description: string;+ default_subscription: string;+ visibility: string;+ created_at: string;+ }[];+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/topics' });+ return response.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/list-webhooks.action.ts b/packages/pieces/community/resend/src/lib/actions/list-webhooks.action.tsnew file mode 100644index 00000000000..afbfafd86cc--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/list-webhooks.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { listWebhooksOutputSchema } from '../output-schemas';++export const listWebhooks = createAction({+ name: 'list_webhooks',+ classification: 'SEARCH',+ auth: resendAuth,+ displayName: 'List Webhooks',+ outputSchema: listWebhooksOutputSchema,+ description: 'Retrieve all webhooks configured on your Resend account',+ audience: 'ai',+ aiMetadata: { description: "Retrieves every webhook configured on the account, including each one's endpoint URL, status, and subscribed events. Use this to discover a webhook ID or audit existing subscriptions. Read-only and idempotent.", idempotent: true },+ props: {},+ async run({ auth }) {+ const response = await resendClient.sendRequest<{+ data: { id: string; created_at: string; status: string; endpoint: string; events: string[] }[];+ }>({ auth: auth.secret_text, method: HttpMethod.GET, path: '/webhooks' });+ return response.data;+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/publish-template.action.ts b/packages/pieces/community/resend/src/lib/actions/publish-template.action.tsnew file mode 100644index 00000000000..7bdc931b546--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/publish-template.action.ts@@ -0,0 +1,23 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { publishTemplateOutputSchema } from '../output-schemas';++export const publishTemplate = createAction({+ name: 'publish_template',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Publish Template',+ outputSchema: publishTemplateOutputSchema,+ description: "Make a template's latest version live",+ audience: 'ai',+ aiMetadata: { description: 'Publishes the current draft version of a template, identified by ID or alias, making it the version used when the template is referenced elsewhere. Use this after Create Template or Update Template once the content is ready to go live. Idempotent — publishing an already-published version with no pending changes is a no-op.', idempotent: true },+ props: {+ template_id: resendProps.templateId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/templates/${propsValue.template_id}/publish` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/remove-contact-from-segment.action.ts b/packages/pieces/community/resend/src/lib/actions/remove-contact-from-segment.action.tsnew file mode 100644index 00000000000..71c4ca9ba4b--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/remove-contact-from-segment.action.ts@@ -0,0 +1,24 @@+import { createAction } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { removeContactFromSegmentOutputSchema } from '../output-schemas';++export const removeContactFromSegment = createAction({+ name: 'remove_contact_from_segment',+ classification: 'DESTRUCTIVE',+ auth: resendAuth,+ displayName: 'Remove Contact From Segment',+ outputSchema: removeContactFromSegmentOutputSchema,+ description: 'Remove a contact from a segment',+ audience: 'ai',+ aiMetadata: { description: 'Removes a contact (identified by ID or email) from a segment (identified by segment ID). Use List Contact Segments to confirm current membership first. Effectively idempotent — once removed, repeating the call has no further effect.', idempotent: true },+ props: {+ contact_identifier: resendProps.contactIdentifier,+ segment_id: resendProps.segmentId,+ },+ async run({ auth, propsValue }) {+ return await resendClient.sendRequest<{ id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/contacts/${encodeURIComponent(propsValue.contact_identifier)}/segments/${propsValue.segment_id}` });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/reschedule-email.action.ts b/packages/pieces/community/resend/src/lib/actions/reschedule-email.action.tsindex 76d0eef972f..83b57c6ad86 100644--- a/packages/pieces/community/resend/src/lib/actions/reschedule-email.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/reschedule-email.action.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { rescheduleEmailOutputSchema } from '../output-schemas';export const rescheduleEmail = createAction({@@ -25,12 +26,6 @@ export const rescheduleEmail = createAction({}),},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.PATCH,- url: `https://api.resend.com/emails/${propsValue.email_id}`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body: { scheduled_at: propsValue.scheduled_at },- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.PATCH, path: `/emails/${propsValue.email_id}`, body: { scheduled_at: propsValue.scheduled_at } });},});diff --git a/packages/pieces/community/resend/src/lib/actions/send-batch-emails.action.ts b/packages/pieces/community/resend/src/lib/actions/send-batch-emails.action.tsindex c2773862aa9..66d22159561 100644--- a/packages/pieces/community/resend/src/lib/actions/send-batch-emails.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/send-batch-emails.action.ts@@ -1,14 +1,9 @@import { createAction, Property } from '@activepieces/pieces-framework';-import {- AuthenticationType,- HttpMethod,- httpClient,-} from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { sendBatchEmailsOutputSchema } from '../output-schemas';-const BASE_URL = 'https://api.resend.com';-export const sendBatchEmails = createAction({name: 'send_batch_emails',classification: 'WRITE',@@ -98,17 +93,14 @@ export const sendBatchEmails = createAction({extraHeaders['Idempotency-Key'] = propsValue.idempotency_key;}- const response = await httpClient.sendRequest<{ data: { id: string }[] }>({+ const response = await resendClient.sendRequest<{ data: { id: string }[] }>({+ auth: auth.secret_text,method: HttpMethod.POST,- url: `${BASE_URL}/emails/batch`,- authentication: {- type: AuthenticationType.BEARER_TOKEN,- token: auth.secret_text,- },+ path: '/emails/batch',headers: extraHeaders,body: batch,});- return response.body.data;+ return response.data;},});diff --git a/packages/pieces/community/resend/src/lib/actions/send-broadcast.action.ts b/packages/pieces/community/resend/src/lib/actions/send-broadcast.action.tsindex f99e4e9f645..20f295fe5a9 100644--- a/packages/pieces/community/resend/src/lib/actions/send-broadcast.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/send-broadcast.action.ts@@ -1,7 +1,8 @@import { createAction, Property } from '@activepieces/pieces-framework';import { sendBroadcastOutputSchema } from '../output-schemas';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';export const sendBroadcast = createAction({@@ -26,12 +27,6 @@ export const sendBroadcast = createAction({const body: Record<string, unknown> = {};if (propsValue.scheduled_at) body['scheduled_at'] = propsValue.scheduled_at;- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.POST,- url: `https://api.resend.com/broadcasts/${propsValue.broadcast_id}/send`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body,- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/broadcasts/${propsValue.broadcast_id}/send`, body: body });},});diff --git a/packages/pieces/community/resend/src/lib/actions/update-contact-property.action.ts b/packages/pieces/community/resend/src/lib/actions/update-contact-property.action.tsnew file mode 100644index 00000000000..01faf70ab64--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/update-contact-property.action.ts@@ -0,0 +1,48 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendProps } from '../common/props';+import { resendClient } from '../common/client';+import { updateContactPropertyOutputSchema } from '../output-schemas';++export const updateContactProperty = createAction({+ name: 'update_contact_property',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Update Contact Property',+ outputSchema: updateContactPropertyOutputSchema,+ description: 'Update the fallback value of a custom contact field',+ audience: 'ai',+ aiMetadata: { description: "Updates the fallback value of an existing custom contact property, identified by ID. The key and type cannot be changed after creation — create a new property instead if either needs to change. Idempotent — re-applying the same value leaves the property unchanged.", idempotent: true },+ props: {+ contact_property_id: resendProps.contactPropertyId,+ fallback_value: Property.ShortText({+ displayName: 'Fallback Value',+ description: "New default value, used when the property is not set on a contact. Must match the property's type.",+ required: true,+ }),+ },+ async run({ auth, propsValue }) {+ const existing = await resendClient.sendRequest<{ type: 'string' | 'number' }>({+ auth: auth.secret_text,+ method: HttpMethod.GET,+ path: `/contact-properties/${propsValue.contact_property_id}`,+ });++ let fallback_value: string | number = propsValue.fallback_value;+ if (existing.type === 'number') {+ const parsed = Number(propsValue.fallback_value);+ if (propsValue.fallback_value.trim() === '' || !Number.isFinite(parsed)) {+ throw new Error(`Fallback Value must be a valid number, got "${propsValue.fallback_value}".`);+ }+ fallback_value = parsed;+ }++ return await resendClient.sendRequest<{ object: string; id: string }>({+ auth: auth.secret_text,+ method: HttpMethod.PATCH,+ path: `/contact-properties/${propsValue.contact_property_id}`,+ body: { fallback_value },+ });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/update-contact.action.ts b/packages/pieces/community/resend/src/lib/actions/update-contact.action.tsindex eb433d80e2a..63025fb393c 100644--- a/packages/pieces/community/resend/src/lib/actions/update-contact.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/update-contact.action.ts@@ -1,6 +1,7 @@import { createAction, Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { updateContactOutputSchema } from '../output-schemas';@@ -41,12 +42,6 @@ export const updateContact = createAction({body['unsubscribed'] = propsValue.unsubscribed;}- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.PATCH,- url: `https://api.resend.com/audiences/${propsValue.audience_id}/contacts/${propsValue.contact_id}`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- body,- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.PATCH, path: `/audiences/${propsValue.audience_id}/contacts/${propsValue.contact_id}`, body: body });},});diff --git a/packages/pieces/community/resend/src/lib/actions/update-template.action.ts b/packages/pieces/community/resend/src/lib/actions/update-template.action.tsnew file mode 100644index 00000000000..df9ecf76432--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/update-template.action.ts@@ -0,0 +1,39 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { updateTemplateOutputSchema } from '../output-schemas';++export const updateTemplate = createAction({+ name: 'update_template',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Update Template',+ outputSchema: updateTemplateOutputSchema,+ description: "Update an existing email template's content or metadata",+ audience: 'ai',+ aiMetadata: { description: 'Updates the name, alias, sender, subject, reply-to, or body of an existing email template, identified by ID or alias. Only supplied fields change. If the template was already published, changes apply as a new unpublished version until Publish Template is called again. Idempotent — re-applying the same values leaves the template unchanged.', idempotent: true },+ props: {+ template_id: resendProps.templateId,+ name: Property.ShortText({ displayName: 'Name', required: false }),+ alias: Property.ShortText({ displayName: 'Alias', required: false }),+ from: Property.ShortText({ displayName: 'From', required: false }),+ subject: Property.ShortText({ displayName: 'Default Subject', required: false }),+ reply_to: Property.ShortText({ displayName: 'Reply To', required: false }),+ html: Property.LongText({ displayName: 'HTML Body', required: false }),+ text: Property.LongText({ displayName: 'Text Body', required: false }),+ },+ async run({ auth, propsValue }) {+ const body: Record<string, unknown> = {};+ if (propsValue.name) body['name'] = propsValue.name;+ if (propsValue.alias) body['alias'] = propsValue.alias;+ if (propsValue.from) body['from'] = propsValue.from;+ if (propsValue.subject) body['subject'] = propsValue.subject;+ if (propsValue.reply_to) body['reply_to'] = propsValue.reply_to;+ if (propsValue.html) body['html'] = propsValue.html;+ if (propsValue.text) body['text'] = propsValue.text;++ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.PATCH, path: `/templates/${propsValue.template_id}`, body: body });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/update-topic.action.ts b/packages/pieces/community/resend/src/lib/actions/update-topic.action.tsnew file mode 100644index 00000000000..d6949ea5b00--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/update-topic.action.ts@@ -0,0 +1,40 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { updateTopicOutputSchema } from '../output-schemas';++export const updateTopic = createAction({+ name: 'update_topic',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Update Topic',+ outputSchema: updateTopicOutputSchema,+ description: "Update a topic's name, description, or visibility",+ audience: 'ai',+ aiMetadata: { description: 'Updates the name, description, or visibility of an existing topic, identified by ID. Only supplied fields change; the default subscription setting cannot be changed after creation. Idempotent — re-applying the same values leaves the topic unchanged.', idempotent: true },+ props: {+ topic_id: resendProps.topicId,+ name: Property.ShortText({ displayName: 'Name', required: false }),+ description: Property.LongText({ displayName: 'Description', required: false }),+ visibility: Property.StaticDropdown({+ displayName: 'Visibility',+ required: false,+ options: {+ options: [+ { label: 'Public', value: 'public' },+ { label: 'Private', value: 'private' },+ ],+ },+ }),+ },+ async run({ auth, propsValue }) {+ const body: Record<string, unknown> = {};+ if (propsValue.name) body['name'] = propsValue.name;+ if (propsValue.description) body['description'] = propsValue.description;+ if (propsValue.visibility) body['visibility'] = propsValue.visibility;++ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.PATCH, path: `/topics/${propsValue.topic_id}`, body: body });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/update-webhook.action.ts b/packages/pieces/community/resend/src/lib/actions/update-webhook.action.tsnew file mode 100644index 00000000000..6ca29f631bf--- /dev/null+++ b/packages/pieces/community/resend/src/lib/actions/update-webhook.action.ts@@ -0,0 +1,46 @@+import { createAction, Property } from '@activepieces/pieces-framework';+import { HttpMethod } from '@activepieces/pieces-common';+import { resendAuth } from '../..';+import { resendClient } from '../common/client';+import { resendProps } from '../common/props';+import { updateWebhookOutputSchema } from '../output-schemas';++export const updateWebhook = createAction({+ name: 'update_webhook',+ classification: 'WRITE',+ auth: resendAuth,+ displayName: 'Update Webhook',+ outputSchema: updateWebhookOutputSchema,+ description: "Update a webhook's endpoint, events, or status",+ audience: 'ai',+ aiMetadata: { description: 'Updates the endpoint URL, subscribed event types, or enabled/disabled status of an existing webhook, identified by ID. Only supplied fields change. Use this to pause a webhook (set status to disabled) without deleting it. Idempotent — re-applying the same values leaves the webhook unchanged.', idempotent: true },+ props: {+ webhook_id: resendProps.webhookId,+ endpoint: Property.ShortText({ displayName: 'Endpoint URL', required: false }),+ events: Property.Array({+ displayName: 'Events',+ description: 'Replaces the full set of subscribed event types. Leave blank to keep the current events.',+ required: false,+ }),+ status: Property.StaticDropdown({+ displayName: 'Status',+ required: false,+ options: {+ options: [+ { label: 'Enabled', value: 'enabled' },+ { label: 'Disabled', value: 'disabled' },+ ],+ },+ }),+ },+ async run({ auth, propsValue }) {+ const body: Record<string, unknown> = {};+ if (propsValue.endpoint) body['endpoint'] = propsValue.endpoint;+ if (propsValue.events && (propsValue.events as string[]).length > 0) {+ body['events'] = propsValue.events as string[];+ }+ if (propsValue.status) body['status'] = propsValue.status;++ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.PATCH, path: `/webhooks/${propsValue.webhook_id}`, body: body });+ },+});diff --git a/packages/pieces/community/resend/src/lib/actions/verify-domain.action.ts b/packages/pieces/community/resend/src/lib/actions/verify-domain.action.tsindex c91f494ee97..6c5ef9aff87 100644--- a/packages/pieces/community/resend/src/lib/actions/verify-domain.action.ts+++ b/packages/pieces/community/resend/src/lib/actions/verify-domain.action.ts@@ -1,6 +1,7 @@import { createAction } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';+import { resendClient } from '../common/client';import { resendProps } from '../common/props';import { verifyDomainOutputSchema } from '../output-schemas';@@ -17,11 +18,6 @@ export const verifyDomain = createAction({domain_id: resendProps.domainId,},async run({ auth, propsValue }) {- const response = await httpClient.sendRequest<{ object: string; id: string }>({- method: HttpMethod.POST,- url: `https://api.resend.com/domains/${propsValue.domain_id}/verify`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },- });- return response.body;+ return await resendClient.sendRequest<{ object: string; id: string }>({ auth: auth.secret_text, method: HttpMethod.POST, path: `/domains/${propsValue.domain_id}/verify` });},});diff --git a/packages/pieces/community/resend/src/lib/common/client.ts b/packages/pieces/community/resend/src/lib/common/client.tsnew file mode 100644index 00000000000..1874bae7ced--- /dev/null+++ b/packages/pieces/community/resend/src/lib/common/client.ts@@ -0,0 +1,30 @@+import { AuthenticationType, HttpMethod, httpClient, QueryParams } from '@activepieces/pieces-common';++async function sendRequest<T>({+ auth,+ method,+ path,+ body,+ queryParams,+ headers,+}: {+ auth: string;+ method: HttpMethod;+ path: string;+ body?: unknown;+ queryParams?: QueryParams;+ headers?: Record<string, string>;+}): Promise<T> {+ const response = await httpClient.sendRequest<T>({+ method,+ url: `${RESEND_BASE_URL}${path}`,+ authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth },+ body,+ queryParams,+ headers,+ });+ return response.body;+}++export const resendClient = { sendRequest };+export const RESEND_BASE_URL = 'https://api.resend.com';diff --git a/packages/pieces/community/resend/src/lib/common/props.ts b/packages/pieces/community/resend/src/lib/common/props.tsindex 4caf0d7a4f3..ae3e27cf0f3 100644--- a/packages/pieces/community/resend/src/lib/common/props.ts+++ b/packages/pieces/community/resend/src/lib/common/props.ts@@ -1,8 +1,7 @@import { Property } from '@activepieces/pieces-framework';-import { AuthenticationType, HttpMethod, httpClient } from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import { resendAuth } from '../..';--const BASE_URL = 'https://api.resend.com';+import { resendClient } from './client';const audienceIdProp = Property.Dropdown({displayName: 'Audience',@@ -13,12 +12,12 @@ const audienceIdProp = Property.Dropdown({if (!auth) {return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };}- const response = await httpClient.sendRequest<{ data: { id: string; name: string }[] }>({+ const response = await resendClient.sendRequest<{ data: { id: string; name: string }[] }>({+ auth: auth.secret_text,method: HttpMethod.GET,- url: `${BASE_URL}/audiences`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },+ path: '/audiences',});- return { options: response.body.data.map((a) => ({ label: a.name, value: a.id })) };+ return { options: response.data.map((a) => ({ label: a.name, value: a.id })) };},});@@ -31,12 +30,12 @@ const domainIdProp = Property.Dropdown({if (!auth) {return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };}- const response = await httpClient.sendRequest<{ data: { id: string; name: string }[] }>({+ const response = await resendClient.sendRequest<{ data: { id: string; name: string }[] }>({+ auth: auth.secret_text,method: HttpMethod.GET,- url: `${BASE_URL}/domains`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },+ path: '/domains',});- return { options: response.body.data.map((d) => ({ label: d.name, value: d.id })) };+ return { options: response.data.map((d) => ({ label: d.name, value: d.id })) };},});@@ -49,15 +48,15 @@ const broadcastIdProp = Property.Dropdown({if (!auth) {return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };}- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{data: { id: string; name: string; subject: string }[];}>({+ auth: auth.secret_text,method: HttpMethod.GET,- url: `${BASE_URL}/broadcasts`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },+ path: '/broadcasts',});return {- options: response.body.data.map((b) => ({+ options: response.data.map((b) => ({label: b.name ? `${b.name} — ${b.subject}` : b.subject,value: b.id,})),@@ -74,15 +73,15 @@ const contactIdProp = Property.Dropdown({if (!auth || !audience_id) {return { disabled: true, placeholder: 'Select an audience first', options: [] };}- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{data: { id: string; email: string; first_name: string; last_name: string }[];}>({+ auth: auth.secret_text,method: HttpMethod.GET,- url: `${BASE_URL}/audiences/${String(audience_id)}/contacts`,- authentication: { type: AuthenticationType.BEARER_TOKEN, token: auth.secret_text },+ path: `/audiences/${String(audience_id)}/contacts`,});return {- options: response.body.data.map((c) => {+ options: response.data.map((c) => {const name = [c.first_name, c.last_name].filter(Boolean).join(' ');return { label: name ? `${name} <${c.email}>` : c.email, value: c.id };}),@@ -90,9 +89,116 @@ const contactIdProp = Property.Dropdown({},});+const segmentIdProp = Property.Dropdown({+ displayName: 'Segment',+ required: true,+ auth: resendAuth,+ refreshers: [],+ options: async ({ auth }) => {+ if (!auth) {+ return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };+ }+ const response = await resendClient.sendRequest<{ data: { id: string; name: string }[] }>({+ auth: auth.secret_text,+ method: HttpMethod.GET,+ path: '/segments',+ });+ return { options: response.data.map((s) => ({ label: s.name, value: s.id })) };+ },+});++const topicIdProp = Property.Dropdown({+ displayName: 'Topic',+ required: true,+ auth: resendAuth,+ refreshers: [],+ options: async ({ auth }) => {+ if (!auth) {+ return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };+ }+ const response = await resendClient.sendRequest<{ data: { id: string; name: string }[] }>({+ auth: auth.secret_text,+ method: HttpMethod.GET,+ path: '/topics',+ });+ return { options: response.data.map((t) => ({ label: t.name, value: t.id })) };+ },+});++const templateIdProp = Property.Dropdown({+ displayName: 'Template',+ required: true,+ auth: resendAuth,+ refreshers: [],+ options: async ({ auth }) => {+ if (!auth) {+ return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };+ }+ const response = await resendClient.sendRequest<{ data: { id: string; name: string; alias?: string }[] }>({+ auth: auth.secret_text,+ method: HttpMethod.GET,+ path: '/templates',+ });+ return {+ options: response.data.map((t) => ({+ label: t.alias ? `${t.name} (${t.alias})` : t.name,+ value: t.id,+ })),+ };+ },+});++const webhookIdProp = Property.Dropdown({+ displayName: 'Webhook',+ required: true,+ auth: resendAuth,+ refreshers: [],+ options: async ({ auth }) => {+ if (!auth) {+ return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };+ }+ const response = await resendClient.sendRequest<{ data: { id: string; endpoint: string }[] }>({+ auth: auth.secret_text,+ method: HttpMethod.GET,+ path: '/webhooks',+ });+ return { options: response.data.map((w) => ({ label: w.endpoint, value: w.id })) };+ },+});++const contactPropertyIdProp = Property.Dropdown({+ displayName: 'Contact Property',+ required: true,+ auth: resendAuth,+ refreshers: [],+ options: async ({ auth }) => {+ if (!auth) {+ return { disabled: true, placeholder: 'Connect your Resend account first', options: [] };+ }+ const response = await resendClient.sendRequest<{ data: { id: string; key: string }[] }>({+ auth: auth.secret_text,+ method: HttpMethod.GET,+ path: '/contact-properties',+ });+ return { options: response.data.map((p) => ({ label: p.key, value: p.id })) };+ },+});++const contactIdentifierProp = Property.ShortText({+ displayName: 'Contact ID or Email',+ description: "The contact's Resend ID, or their email address.",+ required: true,+});+export const resendProps = {audienceId: audienceIdProp,domainId: domainIdProp,broadcastId: broadcastIdProp,contactId: contactIdProp,+ segmentId: segmentIdProp,+ topicId: topicIdProp,+ templateId: templateIdProp,+ webhookId: webhookIdProp,+ contactPropertyId: contactPropertyIdProp,+ contactIdentifier: contactIdentifierProp,};diff --git a/packages/pieces/community/resend/src/lib/output-schemas.ts b/packages/pieces/community/resend/src/lib/output-schemas.tsindex 8b3ae762820..e7254e7ec32 100644--- a/packages/pieces/community/resend/src/lib/output-schemas.ts+++ b/packages/pieces/community/resend/src/lib/output-schemas.ts@@ -210,3 +210,312 @@ export const listBroadcastsOutputSchema: OutputSchema = {{ key: 'broadcasts', label: 'Broadcasts', value: '', labelKey: 'name', listItems: broadcastFields },],};++export const getContactOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Contact ID' },+ { key: 'email', label: 'Email', format: 'email' },+ { key: 'first_name', label: 'First Name' },+ { key: 'last_name', label: 'Last Name' },+ { key: 'unsubscribed', label: 'Unsubscribed', format: 'boolean' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ {+ key: 'properties',+ label: 'Custom Properties',+ description: 'Custom contact-property values, keyed by property name.',+ },+ ],+};++// Resend's response calls the segment id `audienceId` here (legacy naming); `id` is the contact.+export const addContactToSegmentOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Contact ID' },+ { key: 'audienceId', label: 'Segment ID' },+ ],+};++export const removeContactFromSegmentOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Contact ID' },+ { key: 'audienceId', label: 'Segment ID' },+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ ],+};++const segmentFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Segment ID' },+ { key: 'name', label: 'Name' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+];++export const listContactSegmentsOutputSchema: OutputSchema = {+ itemLabel: '{name}',+ fields: [+ { key: 'segments', label: 'Segments', value: '', labelKey: 'name', listItems: segmentFields },+ ],+};++export const listContactTopicsOutputSchema: OutputSchema = {+ itemLabel: '{name}',+ fields: [+ {+ key: 'topics',+ label: 'Topics',+ value: '',+ labelKey: 'name',+ listItems: [+ { key: 'id', label: 'Topic ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'subscription', label: 'Subscription', description: 'opt_in or opt_out for this contact.' },+ ],+ },+ ],+};++const contactPropertyFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Contact Property ID' },+ { key: 'key', label: 'Key' },+ { key: 'type', label: 'Type' },+ { key: 'fallback_value', label: 'Fallback Value' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+];++export const createContactPropertyOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Contact Property ID' }],+};++export const getContactPropertyOutputSchema: OutputSchema = {+ fields: contactPropertyFields,+};++export const listContactPropertiesOutputSchema: OutputSchema = {+ itemLabel: '{key}',+ fields: [+ { key: 'properties', label: 'Contact Properties', value: '', labelKey: 'key', listItems: contactPropertyFields },+ ],+};++export const updateContactPropertyOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Contact Property ID' }],+};++export const deleteContactPropertyOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Contact Property ID' },+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ ],+};++export const createSegmentOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Segment ID' },+ { key: 'name', label: 'Name' },+ ],+};++export const getSegmentOutputSchema: OutputSchema = {+ fields: segmentFields,+};++export const listSegmentsOutputSchema: OutputSchema = {+ itemLabel: '{name}',+ fields: [+ { key: 'segments', label: 'Segments', value: '', labelKey: 'name', listItems: segmentFields },+ ],+};++export const deleteSegmentOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Segment ID' },+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ ],+};++const topicFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Topic ID' },+ { key: 'name', label: 'Name' },+ { key: 'description', label: 'Description' },+ { key: 'default_subscription', label: 'Default Subscription' },+ { key: 'visibility', label: 'Visibility' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+];++export const createTopicOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Topic ID' }],+};++export const getTopicOutputSchema: OutputSchema = {+ fields: topicFields,+};++export const listTopicsOutputSchema: OutputSchema = {+ itemLabel: '{name}',+ fields: [+ { key: 'topics', label: 'Topics', value: '', labelKey: 'name', listItems: topicFields },+ ],+};++export const updateTopicOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Topic ID' }],+};++export const deleteTopicOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Topic ID' },+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ ],+};++const templateListFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Template ID' },+ { key: 'name', label: 'Name' },+ { key: 'alias', label: 'Alias' },+ { key: 'status', label: 'Status' },+ { key: 'published_at', label: 'Published At', format: 'datetime' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },+];++export const createTemplateOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Template ID' }],+};++export const getTemplateOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Template ID' },+ { key: 'current_version_id', label: 'Current Version ID' },+ { key: 'alias', label: 'Alias' },+ { key: 'name', label: 'Name' },+ { key: 'status', label: 'Status' },+ { key: 'from', label: 'From' },+ { key: 'subject', label: 'Subject' },+ { key: 'reply_to', label: 'Reply To' },+ { key: 'html', label: 'HTML Body', format: 'html' },+ { key: 'text', label: 'Text Body' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },+ { key: 'published_at', label: 'Published At', format: 'datetime' },+ { key: 'has_unpublished_versions', label: 'Has Unpublished Versions', format: 'boolean' },+ {+ key: 'variables',+ label: 'Variables',+ labelKey: 'key',+ listItems: [+ { key: 'key', label: 'Key' },+ { key: 'type', label: 'Type' },+ { key: 'fallback_value', label: 'Fallback Value' },+ ],+ },+ ],+};++export const listTemplatesOutputSchema: OutputSchema = {+ itemLabel: '{name}',+ fields: [+ { key: 'templates', label: 'Templates', value: '', labelKey: 'name', listItems: templateListFields },+ ],+};++export const updateTemplateOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Template ID' }],+};++export const deleteTemplateOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Template ID' },+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ ],+};++export const publishTemplateOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Template ID' }],+};++export const duplicateTemplateOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Template ID' }],+};++const webhookFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Webhook ID' },+ { key: 'endpoint', label: 'Endpoint URL' },+ { key: 'status', label: 'Status' },+ { key: 'events', label: 'Events', description: 'Event types this webhook is subscribed to.' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+];++export const createWebhookOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Webhook ID' },+ {+ key: 'signing_secret',+ label: 'Signing Secret',+ description: 'Secret used to verify webhook payloads. Store it securely.',+ },+ ],+};++export const getWebhookOutputSchema: OutputSchema = {+ fields: webhookFields,+};++export const listWebhooksOutputSchema: OutputSchema = {+ itemLabel: '{endpoint}',+ fields: [+ { key: 'webhooks', label: 'Webhooks', value: '', labelKey: 'endpoint', listItems: webhookFields },+ ],+};++export const updateWebhookOutputSchema: OutputSchema = {+ fields: [{ key: 'id', label: 'Webhook ID' }],+};++export const deleteWebhookOutputSchema: OutputSchema = {+ fields: [+ { key: 'id', label: 'Webhook ID' },+ { key: 'deleted', label: 'Deleted', format: 'boolean' },+ ],+};++const emailAttachmentFields: OutputSchema['fields'] = [+ { key: 'id', label: 'Attachment ID' },+ { key: 'filename', label: 'Filename' },+ { key: 'size', label: 'Size (bytes)', format: 'number' },+ { key: 'content_type', label: 'Content Type' },+ { key: 'download_url', label: 'Download URL' },+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },+];++export const getEmailAttachmentOutputSchema: OutputSchema = {+ fields: emailAttachmentFields,+};++export const listEmailAttachmentsOutputSchema: OutputSchema = {+ itemLabel: '{filename}',+ fields: [+ { key: 'attachments', label: 'Attachments', value: '', labelKey: 'filename', listItems: emailAttachmentFields },+ ],+};++export const listReceivedEmailsOutputSchema: OutputSchema = {+ itemLabel: '{subject}',+ fields: [+ {+ key: 'emails',+ label: 'Received Emails',+ value: '',+ labelKey: 'subject',+ listItems: [+ { key: 'id', label: 'Email ID' },+ { key: 'from', label: 'From' },+ { key: 'to', label: 'To', description: 'Recipients, comma-separated.' },+ { key: 'subject', label: 'Subject' },+ { key: 'created_at', label: 'Created At', format: 'datetime' },+ { key: 'cc', label: 'CC', description: 'CC recipients, comma-separated.' },+ { key: 'bcc', label: 'BCC', description: 'BCC recipients, comma-separated.' },+ { key: 'reply_to', label: 'Reply To', description: 'Reply-to addresses, comma-separated.' },+ ],+ },+ ],+};diff --git a/packages/pieces/community/resend/src/lib/triggers/email-bounced.trigger.ts b/packages/pieces/community/resend/src/lib/triggers/email-bounced.trigger.tsindex 6926b8d4fe8..ef81bb26e3d 100644--- a/packages/pieces/community/resend/src/lib/triggers/email-bounced.trigger.ts+++ b/packages/pieces/community/resend/src/lib/triggers/email-bounced.trigger.ts@@ -1,13 +1,9 @@import { createTrigger, TriggerStrategy, Property } from '@activepieces/pieces-framework';-import {- AuthenticationType,- HttpMethod,- httpClient,-} from '@activepieces/pieces-common';+import { HttpMethod } from '@activepieces/pieces-common';import crypto from 'crypto';import { resendAuth } from '../..';+import { resendClient } from '../common/client';-const BASE_URL = 'https://api.resend.com';const STORE_KEY = 'webhookData';const TIMESTAMP_TOLERANCE_SECONDS = 300;@@ -93,36 +89,30 @@ export const emailBounced = createTrigger({}),},async onEnable(context) {- const response = await httpClient.sendRequest<{+ const response = await resendClient.sendRequest<{id: string;signing_secret: string;}>({+ auth: context.auth.secret_text,method: HttpMethod.POST,- url: `${BASE_URL}/webhooks`,- authentication: {- type: AuthenticationType.BEARER_TOKEN,- token: context.auth.secret_text,- },+ path: '/webhooks',body: {endpoint: context.webhookUrl,events: context.propsValue.events,},});await context.store.put(STORE_KEY, {- id: response.body.id,- signingSecret: response.body.signing_secret,+ id: response.id,+ signingSecret: response.signing_secret,});},async onDisable(context) {const data = await context.store.get<{ id: string; signingSecret: string }>(STORE_KEY);if (data?.id) {- await httpClient.sendRequest({+ await resendClient.sendRequest({+ auth: context.auth.secret_text,method: HttpMethod.DELETE,- url: `${BASE_URL}/webhooks/${data.id}`,- authentication: {- type: AuthenticationType.BEARER_TOKEN,- token: context.auth.secret_text,- },+ path: `/webhooks/${data.id}`,});}},