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 { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework';
import { parseurAuth, parseurCommon } from '../common';
import { parserDropdown } from '../common/properties';
import { WebhookInformation } from '../common/types';
export const newDocumentExportFailed = createTrigger({
auth: parseurAuth,
name: 'newDocumentExportFailed',
classification: 'READ',
displayName: 'New Document Export Failed',
description:
'Fires when an automated export endpoint (webhook / integration) fails for a processed document.',
aiMetadata: {
description:
'Fires when delivering a successfully parsed document to a configured export target (webhook or downstream integration) fails for the selected Parseur mailbox. Use to detect and handle export/delivery failures.',
},
props: { mailboxId: parserDropdown({ required: true }) },
sampleData: {},
type: TriggerStrategy.WEBHOOK,
async onEnable(context) {
const response = await parseurCommon.createWebhook({
apiKey: context.auth.secret_text,
event: 'document.export_failed',
target: context.webhookUrl,
category: 'CUSTOM',
});
await parseurCommon.enableWebhook({
apiKey: context.auth.secret_text,
webhookId: response.id,
mailboxId: context.propsValue.mailboxId as number,
});
await context.store.put<WebhookInformation>('_newDocumentExportFailed', {
webhookId: response.id,
});
},
async onDisable(context) {
const webhookInfo = await context.store.get<WebhookInformation>(
'_newDocumentExportFailed'
);
if (!webhookInfo) {
return;
}
await parseurCommon.deleteWebhook({
apiKey: context.auth.secret_text,
webhookId: webhookInfo.webhookId,
});
await context.store.delete('_newDocumentExportFailed');
},
async run(context) {
return [context.payload.body];
},
});