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 } from '@activepieces/pieces-framework';

import { microsoftTeamsAuth } from '../../../auth';
import { microsoftTeamsAiProps } from '../../../common/ai-props';
import { microsoftTeamsClient } from '../../../common/client';
import { microsoftTeamsGetChannelOutputSchema } from '../../../output-schemas';

export const getChannel = createAction({
  auth: microsoftTeamsAuth,
  name: 'microsoft_teams_get_channel',
  outputSchema: microsoftTeamsGetChannelOutputSchema,
  displayName: 'Get Channel',
  description: 'Gets one channel of a team by its ID.',
  audience: 'ai',
  classification: 'READ',
  aiMetadata: {
    description:
      'Gets one channel of a team by its ID, with its name, description, membership type and web URL. Team IDs come from List Joined Teams and channel IDs from List Channels or List All Channels.',
    idempotent: true,
  },
  props: {
    teamId: microsoftTeamsAiProps.teamId({ required: true }),
    channelId: microsoftTeamsAiProps.channelId({ required: true }),
  },
  async run(context) {
    const { teamId, channelId } = context.propsValue;
    const client = microsoftTeamsClient.create({ auth: context.auth });
    return await microsoftTeamsClient.withRetry(() => client.api(`/teams/${teamId}/channels/${channelId}`).get());
  },
});