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

export const createTeam = createAction({
  auth: webexAuth,
  name: 'createTeam',
  classification: 'WRITE',
  displayName: 'Create Team',
  description:
    'Create a new Webex team. The authenticated user is automatically added as a member.',
  audience: 'both',
  aiMetadata: {
    description:
      'Creates a new Webex team with the given name and an optional description. Use it to set up a team that can group multiple rooms. Each call creates a distinct team, so it is not idempotent.',
    idempotent: false,
  },
  props: {
    name: Property.ShortText({
      displayName: 'Team Name',
      description: 'A user-friendly name for the team',
      required: true,
    }),
    description: Property.LongText({
      displayName: 'Description',
      description: 'The description of the team (optional)',
      required: false,
    }),
  },
  async run(context) {
    const name = context.propsValue.name as string;
    const description = context.propsValue.description as string | undefined;

    const body: Record<string, unknown> = {
      name,
    };

    if (description) {
      body['description'] = description;
    }

    const response = await makeRequest(
      context.auth.access_token,
      HttpMethod.POST,
      '/teams',
      body
    );

    return response;
  },
});