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.9 KB
Raw Blame
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { flipandoAuth } from '../common/auth';
import { BASE_URL, makeRequest } from '../common/client';

export const runAppGenerator = createAction({
  auth: flipandoAuth,
  name: 'runAppGenerator',
  displayName: 'Run App Generator',
  description:
    "Triggers the execution of Flipando's Special App Generator, initiating a background job for application completion.",
  audience: 'both',
  aiMetadata: {
    description:
      "Runs Flipando's Special App Generator to build a new application, starting an asynchronous completion job (retrieve the result later via Get Task). Use it to create a new app from JSON input variables rather than running an existing one; the is_new_app_private flag controls whether the generated app is private or public. Not idempotent: each call generates a new app.",
    idempotent: false,
  },
  props: {
    inputs_data: Property.LongText({
      displayName: 'Inputs Data',
      description:
        'JSON string of key-value pairs for application input variables.',
      required: false,
    }),
    is_new_app_private: Property.Checkbox({
      displayName: 'Is New App Private',
      description:
        'Whether the new app to be created should be private or public.',
      required: true,
      defaultValue: true,
    }),
  },
  async run(context) {
    const apiKey = context.auth.secret_text;
    const inputsData = context.propsValue.inputs_data;
    const isNewAppPrivate = context.propsValue.is_new_app_private;

    const formData = new FormData();
    if (inputsData) {
      formData.append('inputs_data', inputsData);
    }
    formData.append('is_new_app_private', String(isNewAppPrivate));

    return await makeRequest(
      apiKey,
      HttpMethod.POST,
      '/integrations/applications/app-generator/completion',
      undefined,
      formData
    );
  },
});