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 { HttpMethod } from '@activepieces/pieces-common';
import { Property, createAction } from '@activepieces/pieces-framework';

import { salesloftAuth } from '../auth';
import { salesloftRequest } from '../common/client';

export const listCadencesAction = createAction({
  name: 'list_cadences',
  displayName: 'List Cadences',
  description: 'Fetch a paginated list of cadences from Salesloft.',
  audience: 'both',
  aiMetadata: {
    description:
      'Lists the available cadences (outreach sequences) in Salesloft with pagination. Use to browse cadences or resolve a cadence ID before adding a person to one. Read-only and idempotent.',
    idempotent: true,
  },
  auth: salesloftAuth,
  props: {
    per_page: Property.Number({
      displayName: 'Results Per Page',
      description: 'Number of results per page (max 100).',
      required: false,
      defaultValue: 25,
    }),
    page: Property.Number({
      displayName: 'Page',
      description: 'Page number (1-indexed).',
      required: false,
      defaultValue: 1,
    }),
  },
  async run({ auth, propsValue }) {
    const queryParams: Record<string, string> = {};

    if (propsValue.per_page) {
      queryParams['per_page'] = String(propsValue.per_page);
    }
    if (propsValue.page) {
      queryParams['page'] = String(propsValue.page);
    }

    return salesloftRequest({
      apiKey: auth.secret_text,
      method: HttpMethod.GET,
      path: '/cadences',
      queryParams,
    });
  },
});