Skip to content

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

1.4 KB
Raw Blame
import { createAction, MarkdownVariant, Property } from '@activepieces/pieces-framework';
import { deleteBroadcastOutputSchema } from '../output-schemas';
import { HttpMethod } from '@activepieces/pieces-common';
import { resendAuth } from '../..';
import { resendClient } from '../common/client';
import { resendProps } from '../common/props';

export const deleteBroadcast = createAction({
  name: 'delete_broadcast',
  classification: 'DESTRUCTIVE',
  auth: resendAuth,
  displayName: 'Delete Broadcast',
  outputSchema: deleteBroadcastOutputSchema,
  description: 'Permanently delete a broadcast from your Resend account',
  audience: 'both',
  aiMetadata: { description: 'Permanently deletes a broadcast from the Resend account, identified by broadcast ID. Use this to remove a draft or unwanted campaign; only broadcasts that have not been sent can be deleted. Effectively idempotent — once deleted, repeating the call has no further effect.', idempotent: true },
  props: {
    info: Property.MarkDown({
      value: 'Only broadcasts that have not been sent can be deleted. Deleting a scheduled one cancels its send.',
      variant: MarkdownVariant.INFO,
    }),
    broadcast_id: resendProps.broadcastId,
  },
  async run({ auth, propsValue }) {
    return await resendClient.sendRequest<{ object: string; id: string; deleted: boolean }>({ auth: auth.secret_text, method: HttpMethod.DELETE, path: `/broadcasts/${propsValue.broadcast_id}` });
  },
});