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 { Property } from '@activepieces/pieces-framework';
import { kapsoAuth } from './index';
import { makeClient } from './index';
export const businessAccountIdProp = Property.ShortText({
displayName: 'Business Account ID',
description:
'Your WhatsApp Business Account (WABA) ID. Find it in your [Kapso dashboard](https://app.kapso.ai).',
required: true,
});
export const phoneNumberIdDropdown = Property.Dropdown({
auth: kapsoAuth,
displayName: 'Phone Number',
description: 'Select the WhatsApp phone number to send from.',
required: true,
refreshers: ['businessAccountId'],
options: async ({ auth, businessAccountId }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your Kapso account first',
options: [],
};
}
if (!businessAccountId) {
return {
disabled: true,
placeholder: 'Enter Business Account ID first',
options: [],
};
}
try {
const client = makeClient(auth.secret_text);
const response = await client.request<{
data: Array<{
id: string;
display_phone_number: string;
verified_name: string;
}>;
}>('GET', `${businessAccountId}/phone_numbers`, { responseType: 'json' });
return {
options: response.data.map((pn) => ({
label: `${pn.verified_name} (${pn.display_phone_number})`,
value: pn.id,
})),
};
} catch {
return {
disabled: true,
placeholder: 'Could not load phone numbers',
options: [],
};
}
},
});
export const templateDropdown = Property.Dropdown({
auth: kapsoAuth,
displayName: 'Template',
description: 'Select a message template to send.',
required: true,
refreshers: ['businessAccountId'],
options: async ({ auth, businessAccountId }) => {
if (!auth) {
return {
disabled: true,
placeholder: 'Connect your Kapso account first',
options: [],
};
}
if (!businessAccountId) {
return {
disabled: true,
placeholder: 'Enter Business Account ID first',
options: [],
};
}
try {
const client = makeClient(auth.secret_text);
const response = await client.templates.list({
businessAccountId: businessAccountId as string,
status: 'APPROVED',
limit: 100,
});
return {
options: response.data.map((t) => ({
label: `${t.name} (${t.language ?? 'unknown'})`,
value: JSON.stringify({ name: t.name, language: t.language }),
})),
};
} catch {
return {
disabled: true,
placeholder: 'Could not load templates',
options: [],
};
}
},
});