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 { aidbaseAuth } from '../common/auth';
import { aidbaseClient } from '../common/client';

export const createFaq = createAction({
  auth: aidbaseAuth,
  name: 'create_faq',
  classification: 'WRITE',
  displayName: 'Create FAQ',
  description: 'Creates a new FAQ entry with title and description.',
  audience: 'both',
  aiMetadata: {
    description:
      'Creates a new, empty FAQ knowledge base in Aidbase identified by a title (description optional). Use this first to obtain an FAQ id before adding entries with Add FAQ Item. Not idempotent: each call creates a separate FAQ even with the same title.',
    idempotent: false,
  },

  props: {
    title: Property.ShortText({
      displayName: 'Title',
      description: 'The title of the new FAQ knowledge base.',
      required: true,
    }),
    description: Property.LongText({
      displayName: 'Description',
      description: 'An optional description for the FAQ.',
      required: false,
    }),
  },

  async run(context) {
    const { auth: apiKey, propsValue } = context;
    const { title, description } = propsValue;

    return await aidbaseClient.createFaq(apiKey.secret_text, {
      title,
      description,
    });
  },
});