The `botframework-schema` package provides the TypeScript interfaces and JSON schema definitions for activities exchanged within the Microsoft Bot Framework. This package defines the fundamental structure for messages, conversations, attachments, and other events that occur between a bot and its users across various communication channels. The current stable version is 4.23.3. It is an integral component of the broader Bot Framework JS SDK and follows a consistent release cadence, typically monthly or bi-monthly, synchronizing with the SDK's updates. Releases frequently address security patches, expand Node.js version support, and ensure compatibility with newer TypeScript versions. Its primary differentiation is serving as the canonical and universally recognized schema for all Bot Framework interactions, thereby guaranteeing interoperability and offering robust type safety for bot developers utilizing TypeScript.
npm install botframework-schemaVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to import and create different types of `Activity` objects, including a `MessageActivity` and a generic `Trace` activity, conforming to the `botframework-schema` interfaces.
Upgrade your project's TypeScript version to 5.9 or higher by updating `typescript` in `devDependencies` and configuring your `tsconfig.json`.
Ensure your project runs on Node.js 18 or 20 (LTS versions are recommended). Update your Node.js runtime environment.
Regularly update `botframework-schema` and its peer packages in the Bot Framework SDK to the latest versions to incorporate security fixes. Monitor release notes for any breaking changes in associated SDK packages.
Run `npm install botframework-schema` (or `yarn add botframework-schema`). Verify your `tsconfig.json` includes `"typeRoots": ["./node_modules/@types", "./typings"]` and `"moduleResolution": "Node"` (for most projects) or `"Node16"` / `"Bundler"` for ESM.
When working with `channelData`, ensure your activity variable is typed as `MessageActivity` or explicitly cast it, e.g., `(activity as MessageActivity).channelData`. Always check for existence before accessing properties that are not universally present on all activity types.
Access `activity.text` directly as a string property, e.g., `const message = activity.text;`. If you intended to process text, use string methods like `activity.text.toLowerCase()`.
No dependency data recorded yet.