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.3 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { lightfunnelsAuth } from '../auth';
import { lightfunnelsCommon } from '../common/index';

export const getFunnel = createAction({
  auth: lightfunnelsAuth,
  name: 'get_funnel',
  displayName: 'Get Funnel',
  description: 'Retrieve a specific funnel by ID',
  audience: 'both',
  aiMetadata: { description: 'Fetches a single Lightfunnels funnel by its node ID, returning its name, slug, and published status. Use when you have a funnel ID and need its record. Read-only and idempotent.', idempotent: true },
  props: {
    funnelId: Property.ShortText({
      displayName: 'Funnel ID',
      description: 'The ID of the funnel to retrieve',
      required: true,
    }),
  },
  async run(context) {
    const { funnelId } = context.propsValue;

    const graphqlQuery = `
      query FunnelQuery($id: ID!) {
        node(id: $id) {
          ... on Funnel {
            id
            _id
            name
            slug
            published
            created_at
            updated_at
          }
        }
      }
    `;

    const response = await lightfunnelsCommon.makeGraphQLRequest(
      context.auth,
      graphqlQuery,
      { id: funnelId }
    );

    return response.data.node;
  },
});