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 { microsoftTeamsAuth } from '../auth';
import { createAction, Property } from '@activepieces/pieces-framework';
import { microsoftTeamsProps } from '../common/props';
import { microsoftTeamsClient } from '../common/client';
import { microsoftTeamsGetChatMessageOutputSchema } from '../output-schemas';

export const getChatMessageAction = createAction({
	auth: microsoftTeamsAuth,
	name: 'microsoft_teams_get_chat_message',
	outputSchema: microsoftTeamsGetChatMessageOutputSchema,
	classification: 'READ',
	displayName: 'Get Chat Message',
	description: 'Fetch a specific chat message by chat and message ID.',
	audience: 'human',
	aiMetadata: {
		description: 'Retrieves a single message from a Microsoft Teams chat by chat ID and message ID. Use to read the content or metadata of a known chat message. Idempotent read-only lookup.',
		idempotent: true,
	},
	props: {
		chatId: microsoftTeamsProps.chatId({ required: true }),
		messageId: Property.ShortText({
			displayName: 'Message ID',
			required: true,
			description: 'The ID of the message to retrieve.',
		}),
	},
	async run(context) {
		const { chatId, messageId } = context.propsValue;

		const client = microsoftTeamsClient.create({ auth: context.auth });

		return await microsoftTeamsClient.withRetry(() => client.api(`/chats/${chatId}/messages/${messageId}`).get());
	},
});