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 { wedofAuth } from '../../auth';
import { createAction, DynamicPropsValue, Property } from '@activepieces/pieces-framework';
import { HttpMethod, httpClient } from '@activepieces/pieces-common';
import { wedofCommon } from '../../common/wedof';
export const createCertificationPartnerAudit = createAction({
auth: wedofAuth,
name: 'createCertificationPartnerAudit',
classification: 'WRITE',
displayName: "Créer un audit sur un partenariat de certification",
description: "Permet de créer un audit sur un partenariat de certification",
audience: 'both',
aiMetadata: {
description:
"Create an audit on a single certification partnership in Wedof, using an audit template chosen from those available for the certification. Pick this to audit one specific partner identified by SIRET; use create-general-audit to audit all active partners of a certification at once. Each call creates a new audit, so it is not idempotent. Requires the certification's certifInfo, the partner's SIRET, and a template id.",
idempotent: false,
},
props: {
certifInfo: Property.ShortText({
displayName: 'N° certifInfo',
description: "Permet de n'obtenir que les modèles liés à la certification considérée",
required: true,
}),
siret: Property.ShortText({
displayName: 'N° de siret',
description:
'Sélectionner le SIRET du partenaire',
required: true,
}),
templateId: Property.DynamicProperties({
auth: wedofAuth,
displayName: "Type du modèle d'audit",
refreshers: ['certifInfo'],
required: true,
props: async ({ auth, certifInfo }) => {
if (!certifInfo) {
console.error('certifInfo is undefined');
return {};
}
try {
const response = await httpClient.sendRequest({
method: HttpMethod.GET,
url: `${wedofCommon.baseUrl}/certificationPartnerAuditTemplates`,
queryParams: { certifInfo: certifInfo as unknown as string },
headers: {
'Content-Type': 'application/json',
'X-Api-Key': auth as unknown as string,
},
});
const options = response.body.map((template: { id: string; name: string }) => ({
label: template.name,
value: template.id,
}));
return {
templateId: Property.StaticDropdown({
displayName: "Modèle d'audit",
required: true,
options: {
options: options,
},
}),
} as DynamicPropsValue;
} catch (error) {
console.error('Error fetching templates:', error);
return {};
}
},
}),
},
async run(context) {
const message = {
templateId: context.propsValue.templateId['templateId'] ?? null,
};
return (
await httpClient.sendRequest({
method: HttpMethod.POST,
url:
wedofCommon.baseUrl +
'/certifications/' +
context.propsValue.certifInfo +
'/partners/'+ context.propsValue.siret + '/audits',
body: message,
headers: {
'Content-Type': 'application/json',
'X-Api-Key': context.auth.secret_text,
},
})
).body;
},
});