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 { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { aiAnswerAuth } from '../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { aiAnswerConfig } from '../common/models';
export const scheduleCallAgent = createAction({
name: 'scheduleCallAgent',
classification: 'WRITE',
auth: aiAnswerAuth,
displayName: 'Schedule Call Agent',
description: 'Schedule a call with an agent',
audience: 'both',
aiMetadata: { description: 'Schedules an AI Answer agent to place an outbound call at a future date and time. Use when the call should happen later rather than immediately (for an immediate call use the create phone call action). Requires a valid agent ID, destination phone number, an execution time in YYYY-MM-DD HH:MM:SS format, and a timezone (e.g. Asia/Calcutta); optional prospect details can be attached. Not idempotent — each call schedules a new call.', idempotent: false },
props: {
agentID: Property.ShortText({
displayName: 'Agent ID',
required: true,
}),
phoneNumber: Property.ShortText({
displayName: 'Phone Number',
required: true,
}),
executionTime: Property.ShortText({
displayName: 'Execution Time',
description: 'Time to schedule the call in YYYY-MM-DD HH:MM:SS format.',
required: true,
}),
timezone: Property.ShortText({
displayName: 'Timezone',
description: 'Timezone of the scheduled call (e.g., Asia/Calcutta)',
required: true,
}),
prospectDetails: Property.Object({
displayName: 'Prospect Details',
description: 'Optional prospect details with key-value pairs (e.g., customer_id, priority)',
required: false,
}),
},
async run(context) {
const agentID = context.propsValue.agentID;
const phoneNumber = context.propsValue.phoneNumber;
const executionTime = context.propsValue.executionTime;
const timezone = context.propsValue.timezone;
const prospectDetails = context.propsValue.prospectDetails || {}; // Optional prospect details
const requestBody = {
phone_number: phoneNumber,
execution_time: executionTime,
timezone: timezone,
prospect_details: {
details: prospectDetails, // Nested details object with custom key-value pairs
},
};
const res = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${aiAnswerConfig.baseUrl}/v2/schedule_call_agent/${agentID}`,
headers: {
[aiAnswerConfig.accessTokenHeaderKey]: context.auth.secret_text,
},
queryParams: {
agent_id: agentID
},
body: requestBody,
});
return res.body;
},
});