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
import { createAction } from '@activepieces/pieces-framework';
import { listBroadcastsOutputSchema } from '../output-schemas';
import { HttpMethod } from '@activepieces/pieces-common';
import { resendAuth } from '../..';
import { resendClient } from '../common/client';
interface BroadcastRecord {
id: string;
name: string;
audience_id: string;
from: string;
subject: string;
reply_to: string[];
preview_text: string;
status: string;
created_at: string;
scheduled_at: string | null;
sent_at: string | null;
}
export const listBroadcasts = createAction({
name: 'list_broadcasts',
classification: 'SEARCH',
auth: resendAuth,
displayName: 'List Broadcasts',
outputSchema: listBroadcastsOutputSchema,
description: 'Retrieve all broadcasts in your Resend account',
audience: 'both',
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 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,
from: b.from,
subject: b.subject,
reply_to: Array.isArray(b.reply_to) ? b.reply_to.join(', ') : (b.reply_to ?? ''),
preview_text: b.preview_text ?? '',
status: b.status,
created_at: b.created_at,
scheduled_at: b.scheduled_at ?? '',
sent_at: b.sent_at ?? '',
}));
},
});