UNPKG

@microsoft/teams.apps

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.apps" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.apps/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.apps?activeTab=code

18 lines (17 loc) • 1.06 kB
import { IHtmlWidgetCallToolInvokeActivity, InvokeResponse } from '@microsoft/teams.api'; import { IActivityContext } from '../../contexts'; import { RouteHandler } from '../../types'; /** * Routes for `htmlwidget/calltool` invokes. * * The Teams client adds `arguments.__msteams__ = { mcpUrl, correlationId }` to every request and overwrites any bot-supplied value. * The SDK passes it to the handler untouched. * Handlers should ignore it, validate `arguments` as untrusted input, never throw, and not authorize from `activity.from`. * Return `buildCallToolResponse(...)` so that `content`, `structuredContent` and `isError` are always present. * * @experimental This API is in preview and may change in the future. * Diagnostic: ExperimentalTeamsHtmlWidget */ export type WidgetCallToolRoutes<TExtraCtx extends Record<string, any> = Record<string, any>> = { 'widget.callTool'?: RouteHandler<IActivityContext<IHtmlWidgetCallToolInvokeActivity, TExtraCtx>, InvokeResponse<'htmlwidget/calltool'> | InvokeResponse<'htmlwidget/calltool'>['body']>; };