diff --git a/.github/workflows/build-complete-samples.yml b/.github/workflows/build-complete-samples.yml index b7b3a51ab5..9e357bec34 100644 --- a/.github/workflows/build-complete-samples.yml +++ b/.github/workflows/build-complete-samples.yml @@ -1202,6 +1202,10 @@ jobs: name: 'bot-initiate-thread-in-channel' version: '3.10.x' + - project_path: 'samples/graph-pinned-messages/python' + name: 'graph-pinned-messages' + version: '3.10.x' + - project_path: 'samples/msgext-search/python' name: 'msgext-search' version: '3.10.x' @@ -1217,6 +1221,10 @@ jobs: - project_path: 'samples/msgext-link-unfurling/python' name: 'msgext-link-unfurling' version: '3.10.x' + + - project_path: 'samples/msgext-message-reminder/python' + name: 'msgext-message-reminder' + version: '3.10.x' - project_path: 'samples/msgext-search-auth-config/python' name: 'msgext-search-auth-config' diff --git a/samples/graph-pinned-messages/nodejs/ClientApp/package-lock.json b/samples/graph-pinned-messages/nodejs/ClientApp/package-lock.json index a0ee632201..d63c4c06c9 100644 --- a/samples/graph-pinned-messages/nodejs/ClientApp/package-lock.json +++ b/samples/graph-pinned-messages/nodejs/ClientApp/package-lock.json @@ -57,50 +57,49 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", - "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.25.9", + "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" + "picocolors": "^1.1.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.26.8", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", - "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.0.tgz", + "integrity": "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.12.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", - "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.0.tgz", + "integrity": "sha512-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.1", - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helpers": "^7.12.1", - "@babel/parser": "^7.12.3", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1", - "convert-source-map": "^1.7.0", + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.27.3", + "@babel/helpers": "^7.27.6", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.0", + "@babel/types": "^7.28.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.19", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -110,25 +109,31 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "license": "MIT" + }, "node_modules/@babel/core/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "license": "ISC", "bin": { - "semver": "bin/semver" + "semver": "bin/semver.js" } }, "node_modules/@babel/generator": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.10.tgz", - "integrity": "sha512-rRHT8siFIXQrAYOYqZQVsAr8vJ+cBNqcVAY6m5V8/4QqzaPl+zDBe6cLEPRDuNOUf3ww8RfJVlOyQMoSI+5Ang==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.0.tgz", + "integrity": "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.26.10", - "@babel/types": "^7.26.10", - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25", + "@babel/parser": "^7.28.0", + "@babel/types": "^7.28.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" }, "engines": { @@ -148,13 +153,13 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.26.5", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", - "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.26.5", - "@babel/helper-validator-option": "^7.25.9", + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -244,6 +249,15 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-member-expression-to-functions": { "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", @@ -258,27 +272,27 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", - "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", "license": "MIT", "dependencies": { - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", - "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "version": "7.27.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz", + "integrity": "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg==", "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.25.9", - "@babel/helper-validator-identifier": "^7.25.9", - "@babel/traverse": "^7.25.9" + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.27.3" }, "engines": { "node": ">=6.9.0" @@ -356,27 +370,27 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", - "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", - "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", - "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", "license": "MIT", "engines": { "node": ">=6.9.0" @@ -397,13 +411,13 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", - "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", + "version": "7.27.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.6.tgz", + "integrity": "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug==", "license": "MIT", "dependencies": { - "@babel/template": "^7.26.9", - "@babel/types": "^7.26.10" + "@babel/template": "^7.27.2", + "@babel/types": "^7.27.6" }, "engines": { "node": ">=6.9.0" @@ -496,12 +510,12 @@ } }, "node_modules/@babel/parser": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", - "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.0.tgz", + "integrity": "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g==", "license": "MIT", "dependencies": { - "@babel/types": "^7.26.10" + "@babel/types": "^7.28.0" }, "bin": { "parser": "bin/babel-parser.js" @@ -2076,45 +2090,45 @@ } }, "node_modules/@babel/template": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", - "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.26.2", - "@babel/parser": "^7.26.9", - "@babel/types": "^7.26.9" + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.10.tgz", - "integrity": "sha512-k8NuDrxr0WrPH5Aupqb2LCVURP/S0vBEn5mK6iH+GIYob66U5EtoZvcdudR2jQ4cmTwhEwW1DLB+Yyas9zjF6A==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.0.tgz", + "integrity": "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.10", - "@babel/parser": "^7.26.10", - "@babel/template": "^7.26.9", - "@babel/types": "^7.26.10", - "debug": "^4.3.1", - "globals": "^11.1.0" + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.0", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.0", + "debug": "^4.3.1" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/types": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", - "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", + "version": "7.28.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.1.tgz", + "integrity": "sha512-x0LvFTekgSX+83TI28Y9wYPUfzrnl2aT5+5QLnO6v7mSJYtEEevuDRN0F0uSHRk1G1IWZC43o00Y0xDDrpBGPQ==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.25.9", - "@babel/helper-validator-identifier": "^7.25.9" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -2872,17 +2886,13 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { @@ -2894,15 +2904,6 @@ "node": ">=6.0.0" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/@jridgewell/source-map": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", @@ -2920,9 +2921,9 @@ "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "version": "0.3.29", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz", + "integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==", "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -3573,12 +3574,30 @@ "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", "license": "MIT" }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "license": "MIT", + "peer": true + }, "node_modules/@types/q": { "version": "1.5.8", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.8.tgz", "integrity": "sha512-hroOstUScF6zhIi+5+x0dzqrHA1EJi+Irri6b1fxolMTqqHIV/Cg77EtnQcZqZCu8hR3mX2BzIxN4/GzI68Kfw==", "license": "MIT" }, + "node_modules/@types/react": { + "version": "18.3.23", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.23.tgz", + "integrity": "sha512-/LDXMQh55EzZQ0uVAZmKKhfENivEvWz6E+EYzh+/MCjMhNsotd+ZHhBGIjFDTi6+fz0OhQQQLbTgdQIxxCsC0w==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.0.2" + } + }, "node_modules/@types/resolve": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", @@ -4239,6 +4258,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ansi-html": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", @@ -5083,36 +5114,6 @@ "babel-plugin-transform-react-remove-prop-types": "^0.4.24" } }, - "node_modules/babel-preset-react-app/node_modules/@babel/core": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", - "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.10", - "@babel/helper-compilation-targets": "^7.26.5", - "@babel/helper-module-transforms": "^7.26.0", - "@babel/helpers": "^7.26.10", - "@babel/parser": "^7.26.10", - "@babel/template": "^7.26.9", - "@babel/traverse": "^7.26.10", - "@babel/types": "^7.26.10", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, "node_modules/babel-preset-react-app/node_modules/@babel/plugin-proposal-private-property-in-object": { "version": "7.21.11", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.11.tgz", @@ -5132,21 +5133,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/babel-preset-react-app/node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "license": "MIT" - }, - "node_modules/babel-preset-react-app/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -16981,6 +16967,46 @@ } } }, + "node_modules/react-scripts/node_modules/@babel/core": { + "version": "7.12.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", + "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.1", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.1", + "@babel/parser": "^7.12.3", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/react-scripts/node_modules/@babel/core/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/react-transition-group": { "version": "4.4.5", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", @@ -20476,10 +20502,12 @@ } }, "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", "license": "(MIT OR CC0-1.0)", + "optional": true, + "peer": true, "engines": { "node": ">=10" }, @@ -20589,6 +20617,20 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", diff --git a/samples/graph-pinned-messages/nodejs/ClientApp/src/components/dashboard.jsx b/samples/graph-pinned-messages/nodejs/ClientApp/src/components/dashboard.jsx index 50e80da472..c5cb4b0231 100644 --- a/samples/graph-pinned-messages/nodejs/ClientApp/src/components/dashboard.jsx +++ b/samples/graph-pinned-messages/nodejs/ClientApp/src/components/dashboard.jsx @@ -85,7 +85,13 @@ class Dashboard extends Component { // Exchange client token with server token and fetch the pinned message details. exchangeClientTokenForServerToken = async (token) => { - var id = "ChatId"; //Replace {{ChatId ex - 19:75e4d14a2c2c4644a7adaf4e3976d17b@thread.v2}} + if (!this.state.context || !this.state.context.chat || !this.state.context.chat.id) { + console.error("Chat context is not available"); + this.setState({ isError: true }); + return; + } + + var id = this.state.context.chat.id; axios.get(`/api/chat/getGraphAccessToken?ssoToken=${token}&chatId=${id}`).then((response) => { var responseMessageData = response.data; console.log("-----Response--->",responseMessageData); diff --git a/samples/graph-pinned-messages/python/.env b/samples/graph-pinned-messages/python/.env new file mode 100644 index 0000000000..92182188f2 --- /dev/null +++ b/samples/graph-pinned-messages/python/.env @@ -0,0 +1,3 @@ +MicrosoftAppId= +MicrosoftAppPassword= +AAD_APP_TENANT_ID= \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/.gitignore b/samples/graph-pinned-messages/python/.gitignore new file mode 100644 index 0000000000..a305b3bcfd --- /dev/null +++ b/samples/graph-pinned-messages/python/.gitignore @@ -0,0 +1,14 @@ +# TeamsFx files +env/.env.*.user +appManifest/build/ + +# python virtual environment +.venv/ + +# misc +.deployment/ + +# tmp files +__pycache__/ + +/build/ \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/.vscode/extensions.json b/samples/graph-pinned-messages/python/.vscode/extensions.json new file mode 100644 index 0000000000..bf8c33db9c --- /dev/null +++ b/samples/graph-pinned-messages/python/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "TeamsDevApp.ms-teams-vscode-extension", + "ms-python.python", + ] +} \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/.vscode/launch.json b/samples/graph-pinned-messages/python/.vscode/launch.json new file mode 100644 index 0000000000..6d66d8beb8 --- /dev/null +++ b/samples/graph-pinned-messages/python/.vscode/launch.json @@ -0,0 +1,69 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch App (Edge)", + "type": "msedge", + "request": "launch", + "url": "https://teams.microsoft.com/l/app/${{local:TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&${account-hint}", + "cascadeTerminateToConfigurations": [ + "Python: Run App Locally" + ], + "presentation": { + "group": "all", + "hidden": true + }, + "internalConsoleOptions": "neverOpen" + }, + { + "name": "Launch App (Chrome)", + "type": "chrome", + "request": "launch", + "url": "https://teams.microsoft.com/l/app/${{local:TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&${account-hint}", + "cascadeTerminateToConfigurations": [ + "Python: Run App Locally" + ], + "presentation": { + "group": "all", + "hidden": true + }, + "internalConsoleOptions": "neverOpen" + }, + { + "name": "Python: Run App Locally", + "type": "debugpy", + "request": "launch", + "program": "${workspaceFolder}/app.py", + "cwd": "${workspaceFolder}", + "console": "integratedTerminal" + } + ], + "compounds": [ + { + "name": "Debug (Edge)", + "configurations": [ + "Launch App (Edge)", + "Python: Run App Locally" + ], + "preLaunchTask": "Prepare Teams App Resources", + "presentation": { + "group": "all", + "order": 1 + }, + "stopAll": true + }, + { + "name": "Debug (Chrome)", + "configurations": [ + "Launch App (Chrome)", + "Python: Run App Locally" + ], + "preLaunchTask": "Prepare Teams App Resources", + "presentation": { + "group": "all", + "order": 2 + }, + "stopAll": true + } + ] +} \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/.vscode/settings.json b/samples/graph-pinned-messages/python/.vscode/settings.json new file mode 100644 index 0000000000..436f0a4045 --- /dev/null +++ b/samples/graph-pinned-messages/python/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "debug.onTaskErrors": "abort", + "python.analysis.extraPaths": [ + "./Models" + ] +} diff --git a/samples/graph-pinned-messages/python/.vscode/tasks.json b/samples/graph-pinned-messages/python/.vscode/tasks.json new file mode 100644 index 0000000000..643dd9b802 --- /dev/null +++ b/samples/graph-pinned-messages/python/.vscode/tasks.json @@ -0,0 +1,78 @@ +// This file is automatically generated by Microsoft 365 Agents Toolkit. +// The teamsfx tasks defined in this file require Microsoft 365 Agents Toolkit version >= 5.0.0. +// See https://aka.ms/teamsfx-tasks for details on how to customize each task. +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Prepare Teams App Resources", + "dependsOn": [ + "Validate prerequisites", + "Start local tunnel", + "Provision", + "Deploy" + ], + "dependsOrder": "sequence" + }, + { + // Check all required prerequisites. + // See https://aka.ms/teamsfx-tasks/check-prerequisites to know the details and how to customize the args. + "label": "Validate prerequisites", + "type": "teamsfx", + "command": "debug-check-prerequisites", + "args": { + "prerequisites": [ + "m365Account", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the sideloading permission. + "portOccupancy" // Validate available ports to ensure those debug ones are not occupied. + ], + "portOccupancy": [ + 3978, // app service port + ] + } + }, + { + // Start the local tunnel service to forward public URL to local port and inspect traffic. + // See https://aka.ms/teamsfx-tasks/local-tunnel for the detailed args definitions. + "label": "Start local tunnel", + "type": "teamsfx", + "command": "debug-start-local-tunnel", + "args": { + "type": "dev-tunnel", + "ports": [ + { + "portNumber": 3978, + "protocol": "http", + "access": "public", + "writeToEnvironmentFile": { + "endpoint": "BOT_ENDPOINT", // output tunnel endpoint as BOT_ENDPOINT + "domain": "BOT_DOMAIN" // output tunnel domain as BOT_DOMAIN + } + } + ], + "env": "local" + }, + "isBackground": true, + "problemMatcher": "$teamsfx-local-tunnel-watch" + }, + { + // Create the debug resources. + // See https://aka.ms/teamsfx-tasks/provision to know the details and how to customize the args. + "label": "Provision", + "type": "teamsfx", + "command": "provision", + "args": { + "env": "local" + } + }, + { + // Build project. + // See https://aka.ms/teamsfx-tasks/deploy to know the details and how to customize the args. + "label": "Deploy", + "type": "teamsfx", + "command": "deploy", + "args": { + "env": "local" + } + } + ] +} \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/Images/1.AddInChat.png b/samples/graph-pinned-messages/python/Images/1.AddInChat.png new file mode 100644 index 0000000000..efa65e14ac Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/1.AddInChat.png differ diff --git a/samples/graph-pinned-messages/python/Images/2.Save.png b/samples/graph-pinned-messages/python/Images/2.Save.png new file mode 100644 index 0000000000..e775ae49bd Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/2.Save.png differ diff --git a/samples/graph-pinned-messages/python/Images/3.Tab_Pin_Message.png b/samples/graph-pinned-messages/python/Images/3.Tab_Pin_Message.png new file mode 100644 index 0000000000..a530c11b3c Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/3.Tab_Pin_Message.png differ diff --git a/samples/graph-pinned-messages/python/Images/4.Successful_Message.png b/samples/graph-pinned-messages/python/Images/4.Successful_Message.png new file mode 100644 index 0000000000..aba3447c3d Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/4.Successful_Message.png differ diff --git a/samples/graph-pinned-messages/python/Images/5.Pinned_Message_In_Tab.png b/samples/graph-pinned-messages/python/Images/5.Pinned_Message_In_Tab.png new file mode 100644 index 0000000000..0ebe44de39 Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/5.Pinned_Message_In_Tab.png differ diff --git a/samples/graph-pinned-messages/python/Images/6.Pinned_Message_In_Chat.png b/samples/graph-pinned-messages/python/Images/6.Pinned_Message_In_Chat.png new file mode 100644 index 0000000000..521e9c962f Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/6.Pinned_Message_In_Chat.png differ diff --git a/samples/graph-pinned-messages/python/Images/7.Pin_Mesage_From_Chat.png b/samples/graph-pinned-messages/python/Images/7.Pin_Mesage_From_Chat.png new file mode 100644 index 0000000000..5f6af7b43f Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/7.Pin_Mesage_From_Chat.png differ diff --git a/samples/graph-pinned-messages/python/Images/8.Message_Pinned.png b/samples/graph-pinned-messages/python/Images/8.Message_Pinned.png new file mode 100644 index 0000000000..21ecd62dac Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/8.Message_Pinned.png differ diff --git a/samples/graph-pinned-messages/python/Images/9.Pinned_Message_In_Tab.png b/samples/graph-pinned-messages/python/Images/9.Pinned_Message_In_Tab.png new file mode 100644 index 0000000000..404ce5e6e8 Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/9.Pinned_Message_In_Tab.png differ diff --git a/samples/graph-pinned-messages/python/Images/GraphPinnedMessage.gif b/samples/graph-pinned-messages/python/Images/GraphPinnedMessage.gif new file mode 100644 index 0000000000..2534be4778 Binary files /dev/null and b/samples/graph-pinned-messages/python/Images/GraphPinnedMessage.gif differ diff --git a/samples/graph-pinned-messages/python/README.md b/samples/graph-pinned-messages/python/README.md new file mode 100644 index 0000000000..e69698ab57 --- /dev/null +++ b/samples/graph-pinned-messages/python/README.md @@ -0,0 +1,181 @@ +--- +page_type: sample +description: This sample application demonstrates how to pin and display messages in Microsoft Teams chat using the Graph API. +products: +- office-teams +- office +- office-365 +languages: +- python +extensions: + contentType: samples + createdDate: "29/07/2025 01:02:15 PM" +urlFragment: officedev-microsoft-teams-samples-graph-pinned-messages-python +--- + +# This is a sample application which demonstrates how to pin messages in chat using Graph api. + +This sample tab application showcases the functionality of pinning messages in Microsoft Teams chat through the Graph API. Users can easily view and manage pinned messages, and the app includes features such as Teams Single Sign-On (SSO) with Flask backend support, ensuring a smooth and interactive experience. + +## Included Features +* Teams SSO (tabs) +* Flask Backend +* Pinned Messages +* Graph API + +## Interaction with app +![pinned-messages ](Images/GraphPinnedMessage.gif) + +## Prerequisites + +- Microsoft Teams is installed and you have an account (not a guest account) +- [Python SDK](https://www.python.org/downloads/) min version 3.8 +- [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/) latest version or equivalent tunnelling solution +- [M365 developer account](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant) or access to a Teams account with the appropriate permissions to install an app. +- [Microsoft 365 Agents Toolkit for VS Code](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) or [TeamsFx CLI](https://learn.microsoft.com/microsoftteams/platform/toolkit/teamsfx-cli?pivots=version-one) + +## Run the app (Using Microsoft 365 Agents Toolkit for Visual Studio Code) + +The simplest way to run this sample in Teams is to use Microsoft 365 Agents Toolkit for Visual Studio Code. + +1. Ensure you have downloaded and installed [Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview) +2. Install the [Microsoft 365 Agents Toolkit extension](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) +3. Select **File > Open Folder** in VS Code and choose this samples directory from the repo +4. Press **CTRL+Shift+P** to open the command box and enter **Python: Create Environment** to create and activate your desired virtual environment. Remember to select `requirements.txt` as dependencies to install when creating the virtual environment. +5. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps +6. Select **Debug > Start Debugging** or **F5** to run the app in a Teams web client. +7. In the browser that launches, select the **Add** button to install the app to Teams. + +## Setup + +- Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/en-us/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0) +**NOTE:** When you create app registration, you will create an App ID and App password - make sure you keep these for later. + +1. Register a new application in the [Microsoft Entra ID – App Registrations](https://go.microsoft.com/fwlink/?linkid=2083908) portal. + - Select **New Registration** and on the *register an application page*, set following values: + * Set **name** to your app name. + * Choose the **supported account types** (any account type will work) + * Leave **Redirect URI** empty. + * Choose **Register**. + - On the overview page, copy and save the **Application (client) ID, Directory (tenant) ID**. You’ll need those later when updating your Teams application manifest and in the appsettings.json. + - Under **Manage**, select **Expose an API**. + - Select the **Set** link to generate the Application ID URI in the form of `api://{AppID}`. Insert your fully qualified domain name (with a forward slash "/" appended to the end) between the double forward slashes and the GUID. The entire ID should have the form of: `api://fully-qualified-domain-name/{AppID}` + * ex: `api://%ngrokDomain%.ngrok-free.app/00000000-0000-0000-0000-000000000000`. + - Select the **Add a scope** button. In the panel that opens, enter `access_as_user` as the **Scope name**. + - Set **Who can consent?** to `Admins and users` + - Fill in the fields for configuring the admin and user consent prompts with values that are appropriate for the `access_as_user` scope: + * **Admin consent title:** Teams can access the user’s profile. + * **Admin consent description**: Allows Teams to call the app’s web APIs as the current user. + * **User consent title**: Teams can access the user profile and make requests on the user's behalf. + * **User consent description:** Enable Teams to call this app’s APIs with the same rights as the user. + - Ensure that **State** is set to **Enabled** + -. Select **Add scope** + * The domain part of the **Scope name** displayed just below the text field should automatically match the **Application ID** URI set in the previous step, with `/access_as_user` appended to the end: + * `api://[ngrokDomain].ngrok-free.app/00000000-0000-0000-0000-000000000000/access_as_user. + - In the **Authorized client applications** section, identify the applications that you want to authorize for your app’s web application. Each of the following IDs needs to be entered: + * `1fec8e78-bce4-4aaf-ab1b-5451cc387264` (Teams mobile/desktop application) + * `5e3ce6c0-2b1f-4285-8d4b-75ee78787346` (Teams web application) +- **Note** If you want to test or extend your Teams apps across Office and Outlook, kindly add below client application identifiers while doing Azure AD app registration in your tenant: + * `4765445b-32c6-49b0-83e6-1d93765276ca` (Office web) + * `0ec893e0-5785-4de6-99da-4ed124e5296c` (Office desktop) + * `bc59ab01-8403-45c6-8796-ac3ef710b3e3` (Outlook web) + * `d3590ed6-52b3-4102-aeff-aad2292ab01c` (Outlook desktop) +- Navigate to **API Permissions**, and make sure to add the follow permissions: +- Select Add a permission +-  Select Microsoft Graph -\> Delegated permissions. + - `Chat.Read` + - `Chat.ReadWrite` + - `ChatMessage.Send` +- Click on Add permissions. Please make sure to grant the admin consent for the required permissions. +- Navigate to **Authentication** + If an app hasn't been granted IT admin consent, users will have to provide consent the first time they use an app. + Set a redirect URI: + * Select **Add a platform**. + * Select **Single Page Application**. + * Enter the **redirect URI** for the app in the following format: `https://{Base_Url_Domain}/auth-end`. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your `{Base_Url_Domain}` will be`1234.ngrok-free.app` and if you are using dev tunnels then your domain will be `12345.devtunnels.ms`. + +- Navigate to the **Certificates & secrets**. In the Client secrets section, click on "+ New client secret". Add a description (Name of the secret) for the secret and select “Never” for Expires. Click "Add". Once the client secret is created, copy its value, it need to be placed in the appsettings.json. + +2. Setup NGROK + - Run ngrok - point to port 3978 + + ```bash + ngrok http 3978 --host-header="localhost:3978" + ``` + + Alternatively, you can also use the `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below: + + ```bash + devtunnel host -p 3978 --allow-anonymous + ``` + +### 3. Setup for code + +1. Clone the repository + ```bash + git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git + ``` + +2. In the folder where repository is cloned navigate to `samples/graph-pinned-messages/python` + +3. Create and activate a virtual environment + ```bash + python -m venv env + env\Scripts\activate # On Windows + ``` + +4. Install dependencies + ```bash + pip install -r requirements.txt + ``` + +5. Update the `config.py` configuration with the ```APP_ID```, ```APP_PASSWORD``` and ```AAD_APP_TENANT_ID``` with values generated in step 1 while doing App Registration. + +6. Run your app + ```bash + python app.py + ``` + +### 4. Setup Manifest for Teams +1) __*This step is specific to Teams.*__ + - **Edit** the `manifest.json` contained in the `appManifest` folder to replace your Microsoft App Id (that was created when you registered your app earlier) *everywhere* you see the place holder string `<>` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`) + - **Edit** the `manifest.json` for `configurationUrl` inside `configurableTabs` . Replace `{{BASE-URL-DOMAIN}}` with your app's base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your base url domain will be `1234.ngrok-free.app`. + - **Edit** the `manifest.json` for `validDomains` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`. + - **Zip** up the contents of the `appManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package) + - **Upload** the `manifest.zip` to Teams (In Teams Apps/Manage your apps click "Upload an app". Browse to and Open the .zip file. At the next dialog, click the Add button.) + - **Note** Add the app to groupChat scope. + +## Running the sample + +1) Install App and add to chat +![Add In Chat](Images/1.AddInChat.png) + +2) Save the app configuration +![Save Configuration](Images/2.Save.png) + +3) Select Message From List and click "Pin New Message" +![Tab Pin Message](Images/3.Tab_Pin_Message.png) + +4) Successful Message +![Successful Message](Images/4.Successful_Message.png) + +5) Pinned Message will appear in tab +![Tab Pinned Message](Images/5.Pinned_Message_In_Tab.png) + +6) Pinned messages are also visible in the chat +![Pinned Message In Chat](Images/6.Pinned_Message_In_Chat.png) + +7) You can also pin messages directly from the chat interface +![Pin Message From Chat](Images/7.Pin_Mesage_From_Chat.png) + +8) Confirmation that message was pinned successfully +![Message Pinned](Images/8.Message_Pinned.png) + +9) Pinned messages will also appear in the tab interface +![Pinned Message In Tab](Images/9.Pinned_Message_In_Tab.png) + + +## Further reading +- [Pinned message resource type](https://docs.microsoft.com/en-us/graph/api/chat-post-pinnedmessages?view=graph-rest-beta&tabs=csharp) + + \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/aad.manifest.json b/samples/graph-pinned-messages/python/aad.manifest.json new file mode 100644 index 0000000000..c8e3c956c8 --- /dev/null +++ b/samples/graph-pinned-messages/python/aad.manifest.json @@ -0,0 +1,113 @@ +{ + "id": "${{AAD_APP_OBJECT_ID}}", + "appId": "${{AAD_APP_CLIENT_ID}}", + "name": "graph-pinned-messages-aad", + "accessTokenAcceptedVersion": 2, + "signInAudience": "AzureADMyOrg", + "optionalClaims": { + "idToken": [], + "accessToken": [ + { + "name": "idtyp", + "source": null, + "essential": false, + "additionalProperties": [] + } + ], + "saml2Token": [] + }, + "requiredResourceAccess": [ + { + "resourceAppId": "Microsoft Graph", + "resourceAccess": [ + { + "id": "User.Read", + "type": "Scope" + }, + { + "id": "Chat.Read", + "type": "Scope" + }, + { + "id": "Chat.ReadWrite", + "type": "Scope" + }, + { + "id": "ChatMessage.Send", + "type": "Scope" + } + ] + } + ], + "oauth2Permissions": [ + { + "adminConsentDescription": "Allows Teams to call the app's web APIs as the current user.", + "adminConsentDisplayName": "Teams can access app's web APIs", + "id": "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}", + "isEnabled": true, + "type": "User", + "userConsentDescription": "Enable Teams to call this app's web APIs with the same rights that you have", + "userConsentDisplayName": "Teams can access app's web APIs and make requests on your behalf", + "value": "access_as_user" + } + ], + "preAuthorizedApplications": [ + { + "appId": "1fec8e78-bce4-4aaf-ab1b-5451cc387264", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "5e3ce6c0-2b1f-4285-8d4b-75ee78787346", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "d3590ed6-52b3-4102-aeff-aad2292ab01c", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "00000002-0000-0ff1-ce00-000000000000", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "bc59ab01-8403-45c6-8796-ac3ef710b3e3", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "0ec893e0-5785-4de6-99da-4ed124e5296c", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "4765445b-32c6-49b0-83e6-1d93765276ca", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + }, + { + "appId": "4345a7b9-9a63-4910-a426-35363201d503", + "permissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + } + ], + "identifierUris": [ + "api://${{BOT_DOMAIN}}/${{AAD_APP_CLIENT_ID}}" + ], + "replyUrlsWithType": [ + { + "url": "${{BOT_ENDPOINT}}/auth-end", + "type": "Spa" + } + ] +} \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/app.py b/samples/graph-pinned-messages/python/app.py new file mode 100644 index 0000000000..ff48c08479 --- /dev/null +++ b/samples/graph-pinned-messages/python/app.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License.import os + +from flask import Flask, render_template, send_from_directory, request +from flask_cors import CORS +from config import DefaultConfig +from controller.pin_message_controller import chat_api + +app = Flask(__name__, static_folder="static", template_folder="templates") +CORS(app) +config = DefaultConfig() +app.register_blueprint(chat_api, url_prefix='/api/chat') +MICROSOFT_APP_ID = config.APP_ID + +# ---------- ROUTES ---------- # +@app.route('/') +@app.route('/dashboard') +def dashboard(): + return render_template("dashboard.html") + +@app.route('/configure') +def configure(): + return render_template("configure.html") + +@app.route('/auth-start') +def auth_start(): + return render_template("start.html", microsoft_app_id=MICROSOFT_APP_ID) + +@app.route('/auth-end') +def auth_end(): + return render_template("end.html") + +@app.route('/static/') +def static_files(filename): + return send_from_directory(app.static_folder, filename) + +if __name__ == '__main__': + port = int(os.environ.get("PORT", config.PORT)) + app.run(host='0.0.0.0', port=port, debug=True) diff --git a/samples/graph-pinned-messages/python/appManifest/color.png b/samples/graph-pinned-messages/python/appManifest/color.png new file mode 100644 index 0000000000..b8cf81afbe Binary files /dev/null and b/samples/graph-pinned-messages/python/appManifest/color.png differ diff --git a/samples/graph-pinned-messages/python/appManifest/manifest.json b/samples/graph-pinned-messages/python/appManifest/manifest.json new file mode 100644 index 0000000000..40374e7805 --- /dev/null +++ b/samples/graph-pinned-messages/python/appManifest/manifest.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", + "version": "1.0.0", + "id": "${{TEAMS_APP_ID}}", + "developer": { + "name": "Microsoft", + "websiteUrl": "https://www.microsoft.com", + "privacyUrl": "https://www.teams.com/privacy", + "termsOfUseUrl": "https://www.teams.com/termsofuser" + }, + "icons": { + "color": "color.png", + "outline": "outline.png" + }, + "name": { + "short": "Graph Pin message", + "full": "Graph Pin message" + }, + "description": { + "short": "Sample app for pinning chat messages in Teams using the Graph API.", + "full": "This sample application demonstrates how to pin and display messages in Microsoft Teams chat using the Graph API." + }, + "accentColor": "#5558AF", + "configurableTabs": [ + { + "configurationUrl": "https://${{BOT_DOMAIN}}/configure", + "canUpdateConfiguration": true, + "scopes": [ + "groupChat" + ] + } + ], + "permissions": [ + "identity", + "messageTeamMembers" + ], + "validDomains": [ + "${{BOT_DOMAIN}}" + ], + "webApplicationInfo": { + "id": "${{AAD_APP_CLIENT_ID}}", + "resource": "api://${{BOT_DOMAIN}}/${{AAD_APP_CLIENT_ID}}" + } +} \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/appManifest/outline.png b/samples/graph-pinned-messages/python/appManifest/outline.png new file mode 100644 index 0000000000..2c3bf6fa65 Binary files /dev/null and b/samples/graph-pinned-messages/python/appManifest/outline.png differ diff --git a/samples/graph-pinned-messages/python/assets/sample.json b/samples/graph-pinned-messages/python/assets/sample.json new file mode 100644 index 0000000000..721ed9923d --- /dev/null +++ b/samples/graph-pinned-messages/python/assets/sample.json @@ -0,0 +1,68 @@ +[ + { + "name": "officedev-microsoft-teams-samples-graph-pinned-messages-python", + "source": "officeDev", + "title": "This sample application demonstrates how to pin and display messages in Microsoft Teams chat using the Graph API.", + "shortDescription": "This is a sample application which demonstrates how to pin messages in chat using Graph api.", + "url": "https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/graph-pinned-messages/python", + "longDescription": [ + "This sample application allows users to pin messages in Microsoft Teams chat and view all pinned messages in a group chat, leveraging the Graph API for seamless integration. It supports features like Teams Single Sign-On (SSO), MSAL.js 2.0, and interactive message handling for an enhanced user experience." + ], + "creationDateTime": "2025-07-29", + "updateDateTime": "2025-07-29", + "products": [ + "Teams" + ], + "metadata": [ + { + "key": "TEAMS-SAMPLE-SOURCE", + "value": "OfficeDev" + }, + { + "key": "TEAMS-SERVER-LANGUAGE", + "value": "python" + }, + { + "key": "TEAMS-SERVER-PLATFORM", + "value": "python" + }, + { + "key": "TEAMS-FEATURES", + "value": "tab" + } + ], + "thumbnails": [ + { + "type": "Image", + "order": 100, + "url": "https://raw.githubusercontent.com/OfficeDev/Microsoft-Teams-Samples/main/samples/graph-pinned-messages/python/Images/pinned-messages.png", + "alt": "Solution UX showing pinning of chat messages." + } + ], + "authors": [ + { + "gitHubAccount": "OfficeDev", + "pictureUrl": "https://avatars.githubusercontent.com/u/6789362?s=200&v=4", + "name": "OfficeDev" + } + ], + "references": [ + { + "name": "Teams developer documentation", + "url": "https://aka.ms/TeamsPlatformDocs" + }, + { + "name": "Teams developer questions", + "url": "https://aka.ms/TeamsPlatformFeedback" + }, + { + "name": "Teams development videos from Microsoft", + "url": "https://aka.ms/sample-ref-teams-vids-from-microsoft" + }, + { + "name": "Teams development videos from the community", + "url": "https://aka.ms/community/videos/m365powerplatform" + } + ] + } +] \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/config.py b/samples/graph-pinned-messages/python/config.py new file mode 100644 index 0000000000..e7fd03c1f3 --- /dev/null +++ b/samples/graph-pinned-messages/python/config.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import os + +""" Bot Configuration """ + +class DefaultConfig: + PORT = 3978 + APP_ID = os.environ.get("MicrosoftAppId", "<>") + APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "<>") + AAD_APP_TENANT_ID = os.environ.get("AAD_APP_TENANT_ID") diff --git a/samples/graph-pinned-messages/python/controller/pin_message_controller.py b/samples/graph-pinned-messages/python/controller/pin_message_controller.py new file mode 100644 index 0000000000..4e3318f4e0 --- /dev/null +++ b/samples/graph-pinned-messages/python/controller/pin_message_controller.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +from flask import Blueprint, request, jsonify +from utils.graph_client import GraphClient +from utils.token_exchange import exchange_sso_token_for_graph_token + +chat_api = Blueprint('chat_api', __name__) +delegated_token = "" + +# Retrieves pinned and recent messages from a Teams chat using Graph API. +@chat_api.route('/getGraphAccessToken', methods=['GET']) +def get_graph_access_token(): + global delegated_token + sso_token = request.args.get('ssoToken') + chat_id = request.args.get('chatId') + + if not sso_token or not chat_id: + return jsonify({'error': 'Missing ssoToken or chatId'}), 400 + + try: + access_token = exchange_sso_token_for_graph_token(sso_token) + if not access_token: + return jsonify({'error': 'Failed to exchange token'}), 401 + delegated_token = access_token + graph_client = GraphClient(access_token) + try: + pinned_messages = graph_client.get_pinned_messages(chat_id) + except Exception as e: + pinned_messages = {"value": []} + recent_messages = graph_client.get_recent_messages(chat_id) + message_list = [] + for message in recent_messages.get("value", []): + message_id = message.get('id', 'NO_ID') + message_type = message.get('messageType', 'unknown') + if message_type in ["message", "unknownFutureValue"] or message_type is None: + body = message.get("body", {}) + content = body.get("content", "") if body else "" + if content: + import re + clean_content = re.sub(r'<[^>]+>', '', content) + if clean_content.strip(): + message_details = { + "id": message_id, + "value": clean_content.strip() + } + message_list.append(message_details) + + pinned_values = pinned_messages.get('value', []) + if pinned_values and len(pinned_values) > 0: + pinned_msg = pinned_values[0] + pinned_content = pinned_msg.get('message', {}).get('body', {}).get('content', '') + import re + clean_pinned_content = re.sub(r'<[^>]+>', '', pinned_content) + response_data = { + "id": pinned_msg.get('id', ''), + "message": clean_pinned_content, + "messages": message_list + } + else: + response_data = { + "id": '', + "message": '', + "messages": message_list + } + + return jsonify(response_data) + except Exception as e: + return jsonify({'error': str(e)}), 500 + +# Pins a specific message in a Teams chat. +@chat_api.route('/pinMessage', methods=['GET']) +def pin_new_message(): + sso_token = request.args.get('ssoToken') + chat_id = request.args.get('chatId') + message_id = request.args.get('messageId') + + if not sso_token: + return jsonify({'error': 'Missing ssoToken'}), 400 + if not chat_id: + return jsonify({'error': 'Missing chatId'}), 400 + if not message_id: + return jsonify({'error': 'Missing messageId. Please select a message to pin.'}), 400 + + try: + access_token = exchange_sso_token_for_graph_token(sso_token) + if not access_token: + return jsonify({'error': 'Failed to exchange token'}), 401 + graph_client = GraphClient(access_token) + result = graph_client.pin_message(chat_id, message_id) + return '', 204 + except Exception as e: + return jsonify({'error': str(e)}), 500 + +# Unpins a message from a Teams chat. +@chat_api.route('/unpinMessage', methods=['GET']) +def unpin_message(): + sso_token = request.args.get('ssoToken') + chat_id = request.args.get('chatId') + pinned_message_id = request.args.get('pinnedMessageId') + + if not sso_token: + return jsonify({'error': 'Missing ssoToken'}), 400 + + try: + access_token = exchange_sso_token_for_graph_token(sso_token) + if not access_token: + return jsonify({'error': 'Failed to exchange token'}), 401 + graph_client = GraphClient(access_token) + result = graph_client.unpin_message(chat_id, pinned_message_id) + return '', 204 + except Exception as e: + return jsonify({'error': str(e)}), 500 diff --git a/samples/graph-pinned-messages/python/env/.env.local b/samples/graph-pinned-messages/python/env/.env.local new file mode 100644 index 0000000000..d0c703955f --- /dev/null +++ b/samples/graph-pinned-messages/python/env/.env.local @@ -0,0 +1,17 @@ +BOT_DOMAIN= +BOT_ENDPOINT= +APP_NAME_SUFFIX=local +RESOURCE_SUFFIX= +AZURE_SUBSCRIPTION_ID= +AZURE_RESOURCE_GROUP_NAME= +AAD_APP_CLIENT_ID= +AAD_APP_OBJECT_ID= +AAD_APP_TENANT_ID= +AAD_APP_OAUTH_AUTHORITY= +AAD_APP_OAUTH_AUTHORITY_HOST= +TEAMS_APP_ID= +TEAMS_APP_TENANT_ID= +MICROSOFT_APP_TYPE= +MICROSOFT_APP_TENANT_ID= +AAD_APP_ACCESS_AS_USER_PERMISSION_ID= +TEAMSFX_ENV=local \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/infra/azure.bicep b/samples/graph-pinned-messages/python/infra/azure.bicep new file mode 100644 index 0000000000..8734cb547b --- /dev/null +++ b/samples/graph-pinned-messages/python/infra/azure.bicep @@ -0,0 +1,42 @@ +@maxLength(20) +@minLength(4) +@description('Used to generate names for all resources in this file') +param resourceBaseName string + +@description('Required when create Azure Bot service') +param botAadAppClientId string + +param botAppDomain string + +@maxLength(42) +param botDisplayName string + +param botServiceName string = resourceBaseName +param botServiceSku string = 'F0' + +// Register your web service as a bot with the Bot Framework +resource botService 'Microsoft.BotService/botServices@2021-03-01' = { + kind: 'azurebot' + location: 'global' + name: botServiceName + properties: { + displayName: botDisplayName + endpoint: 'https://${botAppDomain}/api/messages' + msaAppId: botAadAppClientId + msaAppType: 'MultiTenant' + msaAppTenantId: '' + } + sku: { + name: botServiceSku + } +} + +// Connect the bot service to Microsoft Teams +resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = { + parent: botService + location: 'global' + name: 'MsTeamsChannel' + properties: { + channelName: 'MsTeamsChannel' + } +} diff --git a/samples/graph-pinned-messages/python/infra/azure.parameters.json b/samples/graph-pinned-messages/python/infra/azure.parameters.json new file mode 100644 index 0000000000..a788f5f200 --- /dev/null +++ b/samples/graph-pinned-messages/python/infra/azure.parameters.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "resourceBaseName": { + "value": "bot${{RESOURCE_SUFFIX}}" + }, + "botAadAppClientId": { + "value": "${{AAD_APP_CLIENT_ID}}" + }, + "botAppDomain": { + "value": "${{BOT_DOMAIN}}" + }, + "botDisplayName": { + "value": "graph-pinned-messages" + } + } + } \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/m365agents.local.yml b/samples/graph-pinned-messages/python/m365agents.local.yml new file mode 100644 index 0000000000..3a982f586c --- /dev/null +++ b/samples/graph-pinned-messages/python/m365agents.local.yml @@ -0,0 +1,92 @@ +# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json +# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file +# Visit https://aka.ms/teamsfx-actions for details on actions +version: v1.2 + +additionalMetadata: + sampleTag: Microsoft-Teams-Samples:graph-pinned-messages-python + +provision: + # Creates a new Azure Active Directory (AAD) app to authenticate users if the environment variable that stores clientId is empty + - uses: aadApp/create + with: + name: graph-pinned-messages-aad # Note: when you run aadApp/update, the AAD app name will be updated based on the definition in manifest. If you don't want to change the name, make sure the name in AAD manifest is the same with the name defined here. + generateClientSecret: true # If the value is false, the action will not generate client secret for you + signInAudience: "AzureADMultipleOrgs" # Multitenant + writeToEnvironmentFile: # Write the information of created resources into environment file for the specified environment variable(s). + clientId: AAD_APP_CLIENT_ID + clientSecret: SECRET_AAD_APP_CLIENT_SECRET # Environment variable that starts with `SECRET_` will be stored to the .env.{envName}.user environment file + objectId: AAD_APP_OBJECT_ID + tenantId: AAD_APP_TENANT_ID + authority: AAD_APP_OAUTH_AUTHORITY + authorityHost: AAD_APP_OAUTH_AUTHORITY_HOST + + # Creates a Teams app + - uses: teamsApp/create + with: + # Teams app name + name: graph-pinned-messages${{APP_NAME_SUFFIX}} + # Write the information of created resources into environment file for + # the specified environment variable(s). + writeToEnvironmentFile: + teamsAppId: TEAMS_APP_ID + + - uses: script + with: + run: + # echo "::set-teamsfx-env MICROSOFT_APP_TYPE=SingleTenant"; + # echo "::set-teamsfx-env MICROSOFT_APP_TENANT_ID=${{AAD_APP_TENANT_ID}}"; + echo "::set-teamsfx-env MICROSOFT_APP_TYPE=MultiTenant"; + echo "::set-teamsfx-env MICROSOFT_APP_TENANT_ID=common"; + + - uses: arm/deploy # Deploy given ARM templates parallelly. + with: + subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select subscription if it's empty in this case. + resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case. + templates: + - path: ./infra/azure.bicep + parameters: ./infra/azure.parameters.json + deploymentName: Create-resources-for-bot + bicepCliVersion: v0.9.1 # Microsoft 365 Agents Toolkit will download this bicep CLI version from github for you, will use bicep CLI in PATH if you remove this config. + + - uses: aadApp/update # Apply the AAD manifest to an existing AAD app. Will use the object id in manifest file to determine which AAD app to update. + with: + manifestPath: ./aad.manifest.json # Relative path to teamsfx folder. Environment variables in manifest will be replaced before apply to AAD app + outputFilePath: ./build/aad.manifest.${{TEAMSFX_ENV}}.json + + # Validate using manifest schema + - uses: teamsApp/validateManifest + with: + # Path to manifest template + manifestPath: ./appManifest/manifest.json + + # Build Teams app package with latest env value + - uses: teamsApp/zipAppPackage + with: + # Path to manifest template + manifestPath: ./appManifest/manifest.json + outputZipPath: ./appManifest/build/appManifest.${{TEAMSFX_ENV}}.zip + outputJsonPath: ./appManifest/build/manifest.${{TEAMSFX_ENV}}.json + # Validate app package using validation rules + - uses: teamsApp/validateAppPackage + with: + # Relative path to this file. This is the path for built zip file. + appPackagePath: ./appManifest/build/appManifest.${{TEAMSFX_ENV}}.zip + + # Apply the Teams app manifest to an existing Teams app in + # Developer Portal. + # Will use the app id in manifest file to determine which Teams app to update. + - uses: teamsApp/update + with: + # Relative path to this file. This is the path for built zip file. + appPackagePath: ./appManifest/build/appManifest.${{TEAMSFX_ENV}}.zip + +deploy: + # Generate runtime environment variables + - uses: file/createOrUpdateEnvironmentFile + with: + target: ./.env + envs: + MicrosoftAppId: ${{AAD_APP_CLIENT_ID}} + MicrosoftAppPassword: ${{SECRET_AAD_APP_CLIENT_SECRET}} + AAD_APP_TENANT_ID: ${{AAD_APP_TENANT_ID}} \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/m365agents.yml b/samples/graph-pinned-messages/python/m365agents.yml new file mode 100644 index 0000000000..cf6a83bb14 --- /dev/null +++ b/samples/graph-pinned-messages/python/m365agents.yml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json +# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file +# Visit https://aka.ms/teamsfx-actions for details on actions +version: v1.2 + +additionalMetadata: + sampleTag: Microsoft-Teams-Samples:graph-pinned-messagese-python + +environmentFolderPath: ./env diff --git a/samples/graph-pinned-messages/python/requirements.txt b/samples/graph-pinned-messages/python/requirements.txt new file mode 100644 index 0000000000..ac1f751589 --- /dev/null +++ b/samples/graph-pinned-messages/python/requirements.txt @@ -0,0 +1,4 @@ +requests==2.32.3 +botbuilder-integration-aiohttp>=4.16.2 +flask==3.1.1 +flask_cors==6.0.1 \ No newline at end of file diff --git a/samples/graph-pinned-messages/python/templates/configure.html b/samples/graph-pinned-messages/python/templates/configure.html new file mode 100644 index 0000000000..b50ecd0ba9 --- /dev/null +++ b/samples/graph-pinned-messages/python/templates/configure.html @@ -0,0 +1,40 @@ + + + + + + Configure Pinned Messages Tab + + + + +
Please click on save to proceed.
+ + + + diff --git a/samples/graph-pinned-messages/python/templates/dashboard.html b/samples/graph-pinned-messages/python/templates/dashboard.html new file mode 100644 index 0000000000..687d99f2d5 --- /dev/null +++ b/samples/graph-pinned-messages/python/templates/dashboard.html @@ -0,0 +1,181 @@ + + + + + + Pinned Messages Dashboard + + + + + +
+
Graph Pinned Message
+ + + + + + +
+ + + + diff --git a/samples/graph-pinned-messages/python/templates/end.html b/samples/graph-pinned-messages/python/templates/end.html new file mode 100644 index 0000000000..bffb796c9e --- /dev/null +++ b/samples/graph-pinned-messages/python/templates/end.html @@ -0,0 +1,48 @@ + + + + + + End Consent Flow + + + + + +

Consent flow complete.

+ + + + diff --git a/samples/graph-pinned-messages/python/templates/start.html b/samples/graph-pinned-messages/python/templates/start.html new file mode 100644 index 0000000000..861f719c00 --- /dev/null +++ b/samples/graph-pinned-messages/python/templates/start.html @@ -0,0 +1,49 @@ + + + + + + + Start Consent + + + + +

Redirecting to consent page...

+ + + + diff --git a/samples/graph-pinned-messages/python/utils/graph_client.py b/samples/graph-pinned-messages/python/utils/graph_client.py new file mode 100644 index 0000000000..013b6ac3f0 --- /dev/null +++ b/samples/graph-pinned-messages/python/utils/graph_client.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import requests + +GRAPH_API_BASE_URL = "https://graph.microsoft.com/beta" + +class GraphClient: + def __init__(self, access_token: str): + if not access_token: + raise ValueError("Access token is required for GraphClient.") + + self.headers = { + "Authorization": f"Bearer {access_token}", + "Content-Type": "application/json" + } + + # Retrieves all pinned messages from a Teams chat. + def get_pinned_messages(self, chat_id: str): + url = f"{GRAPH_API_BASE_URL}/chats/{chat_id}/pinnedMessages?$expand=message" + response = requests.get(url, headers=self.headers) + if response.status_code == 404: + return {"value": []} + elif response.status_code != 200: + response.raise_for_status() + return response.json() + + # Retrieves the most recent messages from a Teams chat. + def get_recent_messages(self, chat_id: str, top: int = 20): + url = f"{GRAPH_API_BASE_URL}/chats/{chat_id}/messages?$orderby=createdDateTime desc&$top={top}" + response = requests.get(url, headers=self.headers) + response.raise_for_status() + return response.json() + + # Pins a specific message in a Teams chat. + def pin_message(self, chat_id: str, message_id: str): + url = f"{GRAPH_API_BASE_URL}/chats/{chat_id}/pinnedMessages" + payload = { + "message@odata.bind": f"{GRAPH_API_BASE_URL}/chats/{chat_id}/messages/{message_id}" + } + response = requests.post(url, json=payload, headers=self.headers) + response.raise_for_status() + return response.status_code + + # Unpins a message from a Teams chat. + def unpin_message(self, chat_id: str, pinned_message_id: str): + url = f"{GRAPH_API_BASE_URL}/chats/{chat_id}/pinnedMessages/{pinned_message_id}" + response = requests.delete(url, headers=self.headers) + if response.status_code not in [204, 202]: + response.raise_for_status() + return response.status_code diff --git a/samples/graph-pinned-messages/python/utils/token_exchange.py b/samples/graph-pinned-messages/python/utils/token_exchange.py new file mode 100644 index 0000000000..baa8a8d8c7 --- /dev/null +++ b/samples/graph-pinned-messages/python/utils/token_exchange.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import requests +from config import DefaultConfig + +TOKEN_ENDPOINT = "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token" + +# Exchanges SSO token for Graph access token using On-Behalf-Of flow. +def exchange_sso_token_for_graph_token(sso_token: str): + config = DefaultConfig() + try: + if not config.APP_ID: + raise ValueError("APP_ID not configured") + client_secret = config.APP_PASSWORD + if not client_secret or client_secret == "<>": + return None + tenant_id = config.AAD_APP_TENANT_ID + if not tenant_id: + return None + token_url = TOKEN_ENDPOINT.format(tenant=tenant_id) + payload = { + "client_id": config.APP_ID, + "client_secret": client_secret, + "assertion": sso_token, + "assertion_type": "urn:ietf:params:oauth:grant-type:jwt-bearer", + "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer", + "requested_token_use": "on_behalf_of", + "scope": "https://graph.microsoft.com/.default" + } + headers = { + "Content-Type": "application/x-www-form-urlencoded" + } + response = requests.post(token_url, data=payload, headers=headers) + if response.status_code == 200: + token_data = response.json() + return token_data.get("access_token") + else: + return None + except Exception as e: + return None diff --git a/samples/msgext-message-reminder/python/.env b/samples/msgext-message-reminder/python/.env new file mode 100644 index 0000000000..c954d455d1 --- /dev/null +++ b/samples/msgext-message-reminder/python/.env @@ -0,0 +1,5 @@ +MicrosoftAppId= +MicrosoftAppPassword= +MicrosoftAppType=MultiTenant +MicrosoftAppTenantId= +BaseUrl= \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/.gitignore b/samples/msgext-message-reminder/python/.gitignore new file mode 100644 index 0000000000..3144f60181 --- /dev/null +++ b/samples/msgext-message-reminder/python/.gitignore @@ -0,0 +1,12 @@ +# TeamsFx files +env/.env.*.user +appManifest/build/ + +# python virtual environment +.venv/ + +# misc +.deployment/ + +# tmp files +__pycache__/ \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/.vscode/extensions.json b/samples/msgext-message-reminder/python/.vscode/extensions.json new file mode 100644 index 0000000000..bf8c33db9c --- /dev/null +++ b/samples/msgext-message-reminder/python/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "TeamsDevApp.ms-teams-vscode-extension", + "ms-python.python", + ] +} \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/.vscode/launch.json b/samples/msgext-message-reminder/python/.vscode/launch.json new file mode 100644 index 0000000000..6d66d8beb8 --- /dev/null +++ b/samples/msgext-message-reminder/python/.vscode/launch.json @@ -0,0 +1,69 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch App (Edge)", + "type": "msedge", + "request": "launch", + "url": "https://teams.microsoft.com/l/app/${{local:TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&${account-hint}", + "cascadeTerminateToConfigurations": [ + "Python: Run App Locally" + ], + "presentation": { + "group": "all", + "hidden": true + }, + "internalConsoleOptions": "neverOpen" + }, + { + "name": "Launch App (Chrome)", + "type": "chrome", + "request": "launch", + "url": "https://teams.microsoft.com/l/app/${{local:TEAMS_APP_ID}}?installAppPackage=true&webjoin=true&${account-hint}", + "cascadeTerminateToConfigurations": [ + "Python: Run App Locally" + ], + "presentation": { + "group": "all", + "hidden": true + }, + "internalConsoleOptions": "neverOpen" + }, + { + "name": "Python: Run App Locally", + "type": "debugpy", + "request": "launch", + "program": "${workspaceFolder}/app.py", + "cwd": "${workspaceFolder}", + "console": "integratedTerminal" + } + ], + "compounds": [ + { + "name": "Debug (Edge)", + "configurations": [ + "Launch App (Edge)", + "Python: Run App Locally" + ], + "preLaunchTask": "Prepare Teams App Resources", + "presentation": { + "group": "all", + "order": 1 + }, + "stopAll": true + }, + { + "name": "Debug (Chrome)", + "configurations": [ + "Launch App (Chrome)", + "Python: Run App Locally" + ], + "preLaunchTask": "Prepare Teams App Resources", + "presentation": { + "group": "all", + "order": 2 + }, + "stopAll": true + } + ] +} \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/.vscode/settings.json b/samples/msgext-message-reminder/python/.vscode/settings.json new file mode 100644 index 0000000000..3014fd9cf0 --- /dev/null +++ b/samples/msgext-message-reminder/python/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "debug.onTaskErrors": "abort" +} diff --git a/samples/msgext-message-reminder/python/.vscode/tasks.json b/samples/msgext-message-reminder/python/.vscode/tasks.json new file mode 100644 index 0000000000..643dd9b802 --- /dev/null +++ b/samples/msgext-message-reminder/python/.vscode/tasks.json @@ -0,0 +1,78 @@ +// This file is automatically generated by Microsoft 365 Agents Toolkit. +// The teamsfx tasks defined in this file require Microsoft 365 Agents Toolkit version >= 5.0.0. +// See https://aka.ms/teamsfx-tasks for details on how to customize each task. +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Prepare Teams App Resources", + "dependsOn": [ + "Validate prerequisites", + "Start local tunnel", + "Provision", + "Deploy" + ], + "dependsOrder": "sequence" + }, + { + // Check all required prerequisites. + // See https://aka.ms/teamsfx-tasks/check-prerequisites to know the details and how to customize the args. + "label": "Validate prerequisites", + "type": "teamsfx", + "command": "debug-check-prerequisites", + "args": { + "prerequisites": [ + "m365Account", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the sideloading permission. + "portOccupancy" // Validate available ports to ensure those debug ones are not occupied. + ], + "portOccupancy": [ + 3978, // app service port + ] + } + }, + { + // Start the local tunnel service to forward public URL to local port and inspect traffic. + // See https://aka.ms/teamsfx-tasks/local-tunnel for the detailed args definitions. + "label": "Start local tunnel", + "type": "teamsfx", + "command": "debug-start-local-tunnel", + "args": { + "type": "dev-tunnel", + "ports": [ + { + "portNumber": 3978, + "protocol": "http", + "access": "public", + "writeToEnvironmentFile": { + "endpoint": "BOT_ENDPOINT", // output tunnel endpoint as BOT_ENDPOINT + "domain": "BOT_DOMAIN" // output tunnel domain as BOT_DOMAIN + } + } + ], + "env": "local" + }, + "isBackground": true, + "problemMatcher": "$teamsfx-local-tunnel-watch" + }, + { + // Create the debug resources. + // See https://aka.ms/teamsfx-tasks/provision to know the details and how to customize the args. + "label": "Provision", + "type": "teamsfx", + "command": "provision", + "args": { + "env": "local" + } + }, + { + // Build project. + // See https://aka.ms/teamsfx-tasks/deploy to know the details and how to customize the args. + "label": "Deploy", + "type": "teamsfx", + "command": "deploy", + "args": { + "env": "local" + } + } + ] +} \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/Images/1.PersonalChat.png b/samples/msgext-message-reminder/python/Images/1.PersonalChat.png new file mode 100644 index 0000000000..cc4416aabe Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/1.PersonalChat.png differ diff --git a/samples/msgext-message-reminder/python/Images/2.WelcomeMessage.png b/samples/msgext-message-reminder/python/Images/2.WelcomeMessage.png new file mode 100644 index 0000000000..73f44c60cc Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/2.WelcomeMessage.png differ diff --git a/samples/msgext-message-reminder/python/Images/3.CreateReminder.png b/samples/msgext-message-reminder/python/Images/3.CreateReminder.png new file mode 100644 index 0000000000..1f5bcdb2e8 Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/3.CreateReminder.png differ diff --git a/samples/msgext-message-reminder/python/Images/4.Reminder.png b/samples/msgext-message-reminder/python/Images/4.Reminder.png new file mode 100644 index 0000000000..8c86decd2b Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/4.Reminder.png differ diff --git a/samples/msgext-message-reminder/python/Images/5.Channel.png b/samples/msgext-message-reminder/python/Images/5.Channel.png new file mode 100644 index 0000000000..65b8981997 Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/5.Channel.png differ diff --git a/samples/msgext-message-reminder/python/Images/6.ClickCreateReminder.png b/samples/msgext-message-reminder/python/Images/6.ClickCreateReminder.png new file mode 100644 index 0000000000..c0b1f5aadb Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/6.ClickCreateReminder.png differ diff --git a/samples/msgext-message-reminder/python/Images/7.CreateReminder.png b/samples/msgext-message-reminder/python/Images/7.CreateReminder.png new file mode 100644 index 0000000000..5b36fb4549 Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/7.CreateReminder.png differ diff --git a/samples/msgext-message-reminder/python/Images/8.Remider.png b/samples/msgext-message-reminder/python/Images/8.Remider.png new file mode 100644 index 0000000000..8af14daf99 Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/8.Remider.png differ diff --git a/samples/msgext-message-reminder/python/Images/MsgextMessageReminder.gif b/samples/msgext-message-reminder/python/Images/MsgextMessageReminder.gif new file mode 100644 index 0000000000..46e49fcffb Binary files /dev/null and b/samples/msgext-message-reminder/python/Images/MsgextMessageReminder.gif differ diff --git a/samples/msgext-message-reminder/python/README.md b/samples/msgext-message-reminder/python/README.md new file mode 100644 index 0000000000..5cd7fe29f5 --- /dev/null +++ b/samples/msgext-message-reminder/python/README.md @@ -0,0 +1,167 @@ +--- +page_type: sample +description: This comprehensive Python sample illustrates how to create a Messaging Extension that enables users to schedule tasks from within Microsoft Teams, complete with reminder cards sent at the scheduled times. +products: +- office-teams +- office +- office-365 +languages: +- python +extensions: + contentType: samples + createdDate: "23/07/2025" +urlFragment: officedev-microsoft-teams-samples-msgext-message-reminder-python +--- + +# Message reminder with messaging extension action (Python) + +This comprehensive Python sample illustrates how to create a Messaging Extension that enables users to schedule tasks from within Microsoft Teams, complete with reminder cards sent at the scheduled times. With straightforward setup and seamless integration, this extension enhances productivity by allowing users to efficiently manage their tasks and reminders directly within Teams conversations. + +## Included Features +* Messaging Extensions +* Bots +* Adaptive Cards + +## Interaction with app + +![Task Details](Images/MsgextMessageReminder.gif) + +## Try it yourself - experience the App in your Microsoft Teams client + +Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app package (.zip file link below) to your Teams and/or as a personal app. (Sideloading must be enabled for your tenant, [see steps here](https://docs.microsoft.com/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant#enable-custom-teams-apps-and-turn-on-custom-app-uploading)). + +**Message reminder with messaging extension action:** [Manifest](/samples/msgext-message-reminder/python/appManifest/appManifest.local.zip) + +## Prerequisites + +- Microsoft Teams is installed and you have an account (not a guest account) +- [Python SDK](https://www.python.org/downloads/) min version 3.8 +- [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/download) latest version or equivalent tunneling solution +- [M365 developer account](https://docs.microsoft.com/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant) or access to a Teams account with the appropriate permissions to install an app. +- [Microsoft 365 Agents Toolkit for VS Code](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) or [TeamsFx CLI](https://learn.microsoft.com/microsoftteams/platform/toolkit/teamsfx-cli?pivots=version-one). + +## Run the app (Using Microsoft 365 Agents Toolkit for Visual Studio Code) + +The simplest way to run this sample in Teams is to use Microsoft 365 Agents Toolkit for Visual Studio Code. + +1. Ensure you have downloaded and installed [Visual Studio Code](https://code.visualstudio.com/docs/setup/setup-overview) +2. Install the [Microsoft 365 Agents Toolkit extension](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) and [Python Extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) +3. Select **File > Open Folder** in VS Code and choose this sample's directory from the repo +4. Press **CTRL+Shift+P** and enter **Python: Create Environment** to create and activate your virtual environment. Select `requirements.txt` as dependencies to install. +5. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps +6. Select **Debug > Start Debugging** or **F5** to run the app in a Teams web client. +7. In the browser that launches, select the **Add** button to install the app to Teams. + +> If you do not have permission to upload custom apps (sideloading), Microsoft 365 Agents Toolkit will recommend creating and using a Microsoft 365 Developer Program account. + +## Setup + +> Note: These instructions are for running the sample on your local machine. The tunneling solution is required because Teams needs to call into your bot. + +1) **Setup for Bot** +- In Azure portal, create Microsoft Entra ID app registration and it will generate MicrosoftAppId and MicrosoftAppPassword for you. +- In Azure portal, create an [Azure Bot resource](https://docs.microsoft.com/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=python). +- Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0) +- While registering the bot, use `https:///api/messages` as the messaging endpoint. + + > NOTE: When you create your app registration in Azure portal, you will create an App ID and App password - make sure you keep these for later. + +2) **Run ngrok** - point to port 3978 + + ```bash + ngrok http 3978 --host-header="localhost:3978" + ``` + + Alternatively, you can also use the `dev tunnels`: + + ```bash + devtunnel host -p 3978 --allow-anonymous + ``` + +3) **Setup for code** +- Clone the repository + + ```bash + git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git + ``` + +- In the folder where the repository is cloned, navigate to `samples/msgext-message-reminder/python` + +- Create and activate your Python virtual environment + + ```bash + python -m venv venv + source venv/bin/activate # On Windows: venv\Scripts\activate + ``` + +- Install dependencies + + ```bash + pip install -r requirements.txt + ``` + +- Update the `config.py` file in your project folder for the bot to use the `MicrosoftAppId`, `MicrosoftAppPassword` (the AppId and client secret from your Azure registration), and `BaseUrl` (your ngrok or dev tunnel URL). + +- Run your app + + ```bash + python app.py + ``` + +4) **Setup Manifest for Teams** + + - Edit the `manifest.json` contained in the `appManifest/` folder to replace with your MicrosoftAppId (that was created in step 1 and is the same value in `config.py`) *everywhere* you see the place holder string `{{Microsoft-App-Id}}` + - Replace `{{domain-name}}` with your base URL domain (e.g., `1234.ngrok-free.app` or `12345.devtunnels.ms`). + - Zip up the contents of the `appManifest/` folder to create a `manifest.zip` + - Upload the `manifest.zip` to Teams (in the left-bottom *Apps* view, click "Upload a custom app") + +## Running the sample + +**Personal scope scenario** +- Add app in personal scope + +![Add App ](Images/1.PersonalChat.png) + +- select `...` over the message then select `more action` and then `create-reminder` for scheduling task. + +![Schedule task ](Images/2.WelcomeMessage.png) + +- Create Reminder + +![Task Details ](Images/3.CreateReminder.png) + +- Reminder card of task at scheduled date and time. + +![Task reminder](Images/4.Reminder.png) + +**Channel scope scenario** +- Add app in channel + +![Add App ](Images/5.Channel.png) + +- select `...` over the post then select `more action` and then `create-reminder` for scheduling task. + +![Schedule task ](Images/6.ClickCreateReminder.png) + +- Create Reminder + +![Task Details ](Images/7.CreateReminder.png) + +- Reminder card of task at scheduled date and time. + +![Task reminder](Images/8.Remider.png) + +## Deploy the bot to Azure + +To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions. + +## Further reading + +- [Messaging Extension](https://learn.microsoft.com/microsoftteams/platform/messaging-extensions/how-to/action-commands/define-action-command) +- [Bot Framework Documentation](https://docs.botframework.com) +- [Bot Basics](https://docs.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0) +- [Activity processing](https://docs.microsoft.com/azure/bot-service/bot-builder-concept-activity-processing?view=azure-bot-service-4.0) +- [Azure Bot Service Introduction](https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0) +- [Azure Bot Service Documentation](https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0) + + \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/app.py b/samples/msgext-message-reminder/python/app.py new file mode 100644 index 0000000000..a4959a9eab --- /dev/null +++ b/samples/msgext-message-reminder/python/app.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import os +import traceback +from datetime import datetime +from http import HTTPStatus +from aiohttp import web +from aiohttp.web import Request, Response, json_response +import aiohttp_jinja2 +import jinja2 +from botbuilder.core import ( + BotFrameworkAdapterSettings, + BotFrameworkAdapter, + TurnContext, +) +from botbuilder.core.integration import aiohttp_error_middleware +from botbuilder.schema import Activity, ActivityTypes +from bots.bot import MsgextReminderBot +from config import DefaultConfig + +CONFIG = DefaultConfig() +APP = web.Application(middlewares=[aiohttp_error_middleware]) +aiohttp_jinja2.setup(APP, loader=jinja2.FileSystemLoader("views")) +SETTINGS = BotFrameworkAdapterSettings(CONFIG.APP_ID, CONFIG.APP_PASSWORD) +ADAPTER = BotFrameworkAdapter(SETTINGS) + +# Error handling +async def on_error(context: TurnContext, error: Exception): + traceback.print_exc() + await context.send_activity("The bot encountered an error or bug.") + await context.send_activity("Please fix the bot source code to continue.") + if context.activity.channel_id == "emulator": + trace_activity = Activity( + label="TurnError", + name="on_turn_error Trace", + timestamp=datetime.utcnow(), + type=ActivityTypes.trace, + value=str(error), + value_type="https://www.botframework.com/schemas/error", + ) + await context.send_activity(trace_activity) + +ADAPTER.on_turn_error = on_error +BASE_URL = os.environ.get("BaseUrl") +BOT = MsgextReminderBot(base_url=BASE_URL, adapter=ADAPTER) + +async def messages(req: Request) -> Response: + if "application/json" in req.headers.get("Content-Type", ""): + body = await req.json() + else: + return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE) + activity = Activity().deserialize(body) + auth_header = req.headers.get("Authorization", "") + response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn) + if response: + return json_response(data=response.body, status=response.status) + return Response(status=HTTPStatus.OK) + +@aiohttp_jinja2.template("ScheduleTask.html") +async def schedule_task(request: Request): + return {} + +# Register routes +APP.router.add_post("/api/messages", messages) +APP.router.add_get("/scheduleTask", schedule_task) +APP.router.add_static("/Images", path="Images", name="images") + +# Start web server +if __name__ == "__main__": + try: + port = CONFIG.PORT or 3978 + web.run_app(APP, host="localhost", port=port) + except Exception as e: + raise e diff --git a/samples/msgext-message-reminder/python/appManifest/color.png b/samples/msgext-message-reminder/python/appManifest/color.png new file mode 100644 index 0000000000..b8cf81afbe Binary files /dev/null and b/samples/msgext-message-reminder/python/appManifest/color.png differ diff --git a/samples/msgext-message-reminder/python/appManifest/manifest.json b/samples/msgext-message-reminder/python/appManifest/manifest.json new file mode 100644 index 0000000000..7c8f458527 --- /dev/null +++ b/samples/msgext-message-reminder/python/appManifest/manifest.json @@ -0,0 +1,60 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", + "version": "1.0.0", + "id": "${{TEAMS_APP_ID}}", + "developer": { + "name": "Microsoft", + "websiteUrl": "https://www.microsoft.com", + "privacyUrl": "https://www.microsoft.com/privacy", + "termsOfUseUrl": "https://www.microsoft.com/termsofuse" + }, + "name": { + "short": "Message Reminder", + "full": "Message reminder setup through messaging extension action command." + }, + "description": { + "short": "Python Messaging Extension for scheduling tasks and sending reminder cards.", + "full": "This sample demonstrates a Python Messaging Extension that allows users to schedule tasks and receive reminder cards in Microsoft Teams." + }, + "icons": { + "outline": "outline.png", + "color": "color.png" + }, + "accentColor": "#60A18E", + "bots": [ + { + "botId": "${{AAD_APP_CLIENT_ID}}", + "scopes": [ + "personal", + "team" + ], + "isNotificationOnly": false + } + ], + "composeExtensions": [ + { + "botId": "${{AAD_APP_CLIENT_ID}}", + "canUpdateConfiguration": true, + "commands": [ + { + "id": "create-reminder", + "description": "Fetch create-reminder task module", + "title": "Create-reminder", + "type": "action", + "fetchTask": true, + "context": [ + "message" + ] + } + ] + } + ], + "permissions": [ + "identity", + "messageTeamMembers" + ], + "validDomains": [ + "${{BOT_DOMAIN}}" + ] +} \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/appManifest/outline.png b/samples/msgext-message-reminder/python/appManifest/outline.png new file mode 100644 index 0000000000..2c3bf6fa65 Binary files /dev/null and b/samples/msgext-message-reminder/python/appManifest/outline.png differ diff --git a/samples/msgext-message-reminder/python/assets/sample.json b/samples/msgext-message-reminder/python/assets/sample.json new file mode 100644 index 0000000000..9989904d62 --- /dev/null +++ b/samples/msgext-message-reminder/python/assets/sample.json @@ -0,0 +1,68 @@ +[ + { + "name": "officedev-microsoft-teams-samples-msgext-message-reminder-python", + "source": "officeDev", + "title": "Message reminder with messaging extension action", + "shortDescription": "This sample demonstrates a Python Messaging Extension that allows users to schedule tasks and receive reminder cards in Microsoft Teams.", + "url": "https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/msgext-message-reminder/python", + "longDescription": [ + "This Python sample showcases a Messaging Extension where users can schedule tasks directly from messages and receive reminders at specified times. It provides a seamless way for users to manage their tasks and stay organized within Microsoft Teams." + ], + "creationDateTime": "2025-07-23", + "updateDateTime": "2025-07-23", + "products": [ + "Teams" + ], + "metadata": [ + { + "key": "TEAMS-SAMPLE-SOURCE", + "value": "OfficeDev" + }, + { + "key": "TEAMS-SERVER-LANGUAGE", + "value": "python" + }, + { + "key": "TEAMS-SERVER-PLATFORM", + "value": "python" + }, + { + "key": "TEAMS-FEATURES", + "value": "bot,msgext" + } + ], + "thumbnails": [ + { + "type": "image", + "order": 100, + "url": "https://raw.githubusercontent.com/OfficeDev/Microsoft-Teams-Samples/main/samples/msgext-message-reminder/python/Images/msgextmessagereminder.gif", + "alt": "Solution UX showing message reminder with messaging extension action" + } + ], + "authors": [ + { + "gitHubAccount": "OfficeDev", + "pictureUrl": "https://avatars.githubusercontent.com/u/6789362?s=200&v=4", + "name": "OfficeDev" + } + ], + "references": [ + { + "name": "Teams developer documentation", + "url": "https://aka.ms/TeamsPlatformDocs" + }, + { + "name": "Teams developer questions", + "url": "https://aka.ms/TeamsPlatformFeedback" + }, + { + "name": "Teams development videos from Microsoft", + "url": "https://aka.ms/sample-ref-teams-vids-from-microsoft" + }, + { + "name": "Teams development videos from the community", + "url": "https://aka.ms/community/videos/m365powerplatform" + } + ] + } +] \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/bots/__init__.py b/samples/msgext-message-reminder/python/bots/__init__.py new file mode 100644 index 0000000000..4d4b68855b --- /dev/null +++ b/samples/msgext-message-reminder/python/bots/__init__.py @@ -0,0 +1,3 @@ +from .bot import MsgextReminderBot + +__all__ = ["MsgextReminderBot"] \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/bots/bot.py b/samples/msgext-message-reminder/python/bots/bot.py new file mode 100644 index 0000000000..b7e54470db --- /dev/null +++ b/samples/msgext-message-reminder/python/bots/bot.py @@ -0,0 +1,187 @@ +# bot.py +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import schedule +import asyncio +import threading +import time +from datetime import datetime +from botbuilder.schema.teams import ( + MessagingExtensionAction, + MessagingExtensionActionResponse, + TaskModuleContinueResponse, + TaskModuleTaskInfo, +) +from botbuilder.core.teams import TeamsActivityHandler +from botbuilder.core import ( + TurnContext, + CardFactory, + MessageFactory +) +from botbuilder.schema import Activity + +conversation_references = {} +global_adapter = None +task_storage = {} + +# Global flag to ensure scheduler thread is started only once +scheduler_started = False + +def run_scheduler(): + """Run the schedule checker in a background thread""" + while True: + schedule.run_pending() + time.sleep(1) + +class MsgextReminderBot(TeamsActivityHandler): + def __init__(self, base_url: str, adapter): + super().__init__() + self.base_url = base_url + self.adapter = adapter + self._start_scheduler() + + async def on_members_added_activity(self, members_added, turn_context: TurnContext): + """Handle when members are added to the conversation""" + for member in members_added: + if member.id != turn_context.activity.recipient.id: + welcome_text = ( + "Hello and welcome! With this sample you can schedule a message reminder by " + "selecting `...` over the message then select more action and then create-reminder " + "and you will get reminder of the message at scheduled date and time." + ) + await turn_context.send_activity(MessageFactory.text(welcome_text)) + + def _start_scheduler(self): + """Start the scheduler thread if not already started""" + global scheduler_started + if not scheduler_started: + scheduler_thread = threading.Thread(target=run_scheduler, daemon=True) + scheduler_thread.start() + scheduler_started = True + + async def on_teams_messaging_extension_fetch_task( + self, turn_context: TurnContext, action: MessagingExtensionAction + ) -> MessagingExtensionActionResponse: + message = action.message_payload + title = message.body.content if message.body else "" + description = message.subject if message.subject else "" + + task_info = TaskModuleTaskInfo( + title="Schedule task", + height=350, + width=350, + url=f"{self.base_url}/scheduleTask?title={title}&description={description}", + ) + return MessagingExtensionActionResponse( + task=TaskModuleContinueResponse(value=task_info) + ) + + async def on_teams_messaging_extension_submit_action( + self, turn_context: TurnContext, action: MessagingExtensionAction + ) -> MessagingExtensionActionResponse: + global global_adapter + global_adapter = turn_context.adapter + + task_data = action.data + title = task_data.get("taskTitle") + description = task_data.get("description") + date_time_str = task_data.get("dateTime") + + user_id = turn_context.activity.from_property.id + conversation_references[user_id] = TurnContext.get_conversation_reference(turn_context.activity) + + try: + if 'T' in date_time_str and len(date_time_str) == 16: + date_utc = datetime.fromisoformat(date_time_str) + else: + try: + date_utc = datetime.fromisoformat(date_time_str.replace('Z', '+00:00')) + except ValueError: + import re + clean_datetime = re.sub(r'^[A-Za-z]{3},?\s*', '', date_time_str) + clean_datetime = re.sub(r'\s+GMT.*$', '', clean_datetime) + date_utc = datetime.strptime(clean_datetime, '%d %b %Y %H:%M:%S') + + except Exception as e: + await turn_context.send_activity(f"Error parsing date/time: {e}") + return None + + task_storage[user_id] = { + "title": title, + "description": description, + } + + # Schedule the reminder + reminder_time = date_utc.strftime("%H:%M") + + schedule.every().day.at(reminder_time).do( + self._send_reminder, user_id + ).tag(f"reminder_{user_id}") + + await turn_context.send_activity("Task submitted successfully. You will get a reminder at the scheduled time.") + return MessagingExtensionActionResponse() + + def _send_reminder(self, user_id): + task = task_storage.get(user_id) + if not task: + return + + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + try: + loop.run_until_complete(self._send_reminder_async(user_id, task)) + finally: + loop.close() + + async def _send_reminder_async(self, user_id, task): + if user_id not in conversation_references: + return + + ref = conversation_references[user_id] + + async def send_task(turn_context: TurnContext): + card = CardFactory.adaptive_card({ + "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", + "type": "AdaptiveCard", + "version": "1.2", + "body": [ + { + "type": "TextBlock", + "size": "Medium", + "weight": "Bolder", + "text": "Task Reminder!" + }, + { + "type": "TextBlock", + "text": f"**Title:** {task['title']}", + "wrap": True + }, + { + "type": "TextBlock", + "text": f"**Description:** {task['description']}", + "wrap": True + }, + { + "type": "TextBlock", + "text": f"**Time:** {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}", + "wrap": True, + "size": "Small" + } + ] + }) + + message = MessageFactory.attachment(card) + await turn_context.send_activity(message) + + try: + app_id = global_adapter.settings.app_id if global_adapter and global_adapter.settings else None + + await global_adapter.continue_conversation( + ref, + send_task, + app_id + ) + + except Exception as e: + pass diff --git a/samples/msgext-message-reminder/python/config.py b/samples/msgext-message-reminder/python/config.py new file mode 100644 index 0000000000..8dd2ab6c95 --- /dev/null +++ b/samples/msgext-message-reminder/python/config.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import os + +""" Bot Configuration """ + +env_file_path = os.path.join(os.path.dirname(__file__), 'env', '.env.local') +class DefaultConfig: + """ Bot Configuration """ + PORT = 3978 + APP_ID = os.environ.get("AAD_APP_CLIENT_ID") or os.environ.get("MicrosoftAppId") + APP_PASSWORD = os.environ.get("MicrosoftAppPassword") \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/env/.env.local b/samples/msgext-message-reminder/python/env/.env.local new file mode 100644 index 0000000000..079abe8e45 --- /dev/null +++ b/samples/msgext-message-reminder/python/env/.env.local @@ -0,0 +1,21 @@ +# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment. + +# Built-in environment variables +TEAMSFX_ENV=local + +# Generated during provision, you can also add your own variables. If you're adding a secret value, add SECRET_ prefix to the name so Teams Toolkit can handle them properly +BOT_ENDPOINT= +BOT_DOMAIN= +APP_NAME_SUFFIX=local +RESOURCE_SUFFIX= +AZURE_SUBSCRIPTION_ID= +AZURE_RESOURCE_GROUP_NAME= +AAD_APP_CLIENT_ID= +AAD_APP_OBJECT_ID= +AAD_APP_TENANT_ID= +AAD_APP_OAUTH_AUTHORITY= +AAD_APP_OAUTH_AUTHORITY_HOST= +TEAMS_APP_ID= +TEAMS_APP_TENANT_ID= +MICROSOFT_APP_TYPE= +MICROSOFT_APP_TENANT_ID= \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/infra/azure.bicep b/samples/msgext-message-reminder/python/infra/azure.bicep new file mode 100644 index 0000000000..c3ce051b3d --- /dev/null +++ b/samples/msgext-message-reminder/python/infra/azure.bicep @@ -0,0 +1,44 @@ +@maxLength(20) +@minLength(4) +@description('Used to generate names for all resources in this file') +param resourceBaseName string + +@description('Required when create Azure Bot service') +param botAadAppClientId string + +param botAppDomain string + +@maxLength(42) +param botDisplayName string + +param botServiceName string = resourceBaseName +param botServiceSku string = 'F0' +param microsoftAppType string +param microsoftAppTenantId string + +// Register your web service as a bot with the Bot Framework +resource botService 'Microsoft.BotService/botServices@2021-03-01' = { + kind: 'azurebot' + location: 'global' + name: botServiceName + properties: { + displayName: botDisplayName + endpoint: 'https://${botAppDomain}/api/messages' + msaAppId: botAadAppClientId + msaAppType: microsoftAppType + msaAppTenantId: microsoftAppType == 'SingleTenant' ? microsoftAppTenantId : '' + } + sku: { + name: botServiceSku + } +} + +// Connect the bot service to Microsoft Teams +resource botServiceMsTeamsChannel 'Microsoft.BotService/botServices/channels@2021-03-01' = { + parent: botService + location: 'global' + name: 'MsTeamsChannel' + properties: { + channelName: 'MsTeamsChannel' + } +} diff --git a/samples/msgext-message-reminder/python/infra/azure.parameters.json b/samples/msgext-message-reminder/python/infra/azure.parameters.json new file mode 100644 index 0000000000..3eadb2ff32 --- /dev/null +++ b/samples/msgext-message-reminder/python/infra/azure.parameters.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "resourceBaseName": { + "value": "bot${{RESOURCE_SUFFIX}}" + }, + "botAadAppClientId": { + "value": "${{AAD_APP_CLIENT_ID}}" + }, + "botAppDomain": { + "value": "${{BOT_DOMAIN}}" + }, + "botDisplayName": { + "value": "msgext-message-reminder" + }, + "microsoftAppType": { + "value": "${{MICROSOFT_APP_TYPE}}" + }, + "microsoftAppTenantId": { + "value": "${{MICROSOFT_APP_TENANT_ID}}" + } + } +} \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/m365agents.local.yml b/samples/msgext-message-reminder/python/m365agents.local.yml new file mode 100644 index 0000000000..0d969bba3e --- /dev/null +++ b/samples/msgext-message-reminder/python/m365agents.local.yml @@ -0,0 +1,88 @@ +# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json +# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file +# Visit https://aka.ms/teamsfx-actions for details on actions +version: v1.2 + +additionalMetadata: + sampleTag: Microsoft-Teams-Samples:msgext-message-reminder-python + +provision: + - uses: aadApp/create # Creates a new Azure Active Directory (AAD) app to authenticate users if the environment variable that stores clientId is empty + with: + name: msgext-message-reminder-aad # Note: when you run aadApp/update, the AAD app name will be updated based on the definition in manifest. If you don't want to change the name, make sure the name in AAD manifest is the same with the name defined here. + generateClientSecret: true # If the value is false, the action will not generate client secret for you + signInAudience: "AzureADandPersonalMicrosoftAccount" # Multitenant + writeToEnvironmentFile: # Write the information of created resources into environment file for the specified environment variable(s). + clientId: AAD_APP_CLIENT_ID + clientSecret: SECRET_AAD_APP_CLIENT_SECRET # Environment variable that starts with `SECRET_` will be stored to the .env.{envName}.user environment file + objectId: AAD_APP_OBJECT_ID + tenantId: AAD_APP_TENANT_ID + authority: AAD_APP_OAUTH_AUTHORITY + authorityHost: AAD_APP_OAUTH_AUTHORITY_HOST + + # Creates a Teams app + - uses: teamsApp/create + with: + # Teams app name + name: msgext-message-reminder${{APP_NAME_SUFFIX}} + # Write the information of created resources into environment file for + # the specified environment variable(s). + writeToEnvironmentFile: + teamsAppId: TEAMS_APP_ID + + - uses: script + with: + run: + # echo "::set-teamsfx-env MICROSOFT_APP_TYPE=SingleTenant"; + echo "::set-teamsfx-env MICROSOFT_APP_TYPE=MultiTenant"; + echo "::set-teamsfx-env MICROSOFT_APP_TENANT_ID=${{AAD_APP_TENANT_ID}}"; + + - uses: arm/deploy # Deploy given ARM templates parallelly. + with: + subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} # The AZURE_SUBSCRIPTION_ID is a built-in environment variable. TeamsFx will ask you select one subscription if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select subscription if it's empty in this case. + resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} # The AZURE_RESOURCE_GROUP_NAME is a built-in environment variable. TeamsFx will ask you to select or create one resource group if its value is empty. You're free to reference other environment varialbe here, but TeamsFx will not ask you to select or create resource grouop if it's empty in this case. + templates: + - path: ./infra/azure.bicep + parameters: ./infra/azure.parameters.json + deploymentName: Create-resources-for-bot + bicepCliVersion: v0.9.1 # Teams Toolkit will download this bicep CLI version from github for you, will use bicep CLI in PATH if you remove this config. + + # Validate using manifest schema + - uses: teamsApp/validateManifest + with: + # Path to manifest template + manifestPath: ./appManifest/manifest.json + + # Build Teams app package with latest env value + - uses: teamsApp/zipAppPackage + with: + # Path to manifest template + manifestPath: ./appManifest/manifest.json + outputZipPath: ./appManifest/build/appManifest.${{TEAMSFX_ENV}}.zip + outputJsonPath: ./appManifest/build/manifest.${{TEAMSFX_ENV}}.json + # Validate app package using validation rules + - uses: teamsApp/validateAppPackage + with: + # Relative path to this file. This is the path for built zip file. + appPackagePath: ./appManifest/build/appManifest.${{TEAMSFX_ENV}}.zip + + # Apply the Teams app manifest to an existing Teams app in + # Developer Portal. + # Will use the app id in manifest file to determine which Teams app to update. + - uses: teamsApp/update + with: + # Relative path to this file. This is the path for built zip file. + appPackagePath: ./appManifest/build/appManifest.${{TEAMSFX_ENV}}.zip + +deploy: + # Generate runtime environment variables + - uses: file/createOrUpdateEnvironmentFile + with: + target: ./.env + envs: + MicrosoftAppId: ${{AAD_APP_CLIENT_ID}} + MicrosoftAppPassword: ${{SECRET_AAD_APP_CLIENT_SECRET}} + MicrosoftAppType: ${{MICROSOFT_APP_TYPE}} + MicrosoftAppTenantId: ${{MICROSOFT_APP_TENANT_ID}} + BaseUrl: ${{BOT_ENDPOINT}} + \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/m365agents.yml b/samples/msgext-message-reminder/python/m365agents.yml new file mode 100644 index 0000000000..e284c85dc4 --- /dev/null +++ b/samples/msgext-message-reminder/python/m365agents.yml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.2/yaml.schema.json +# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file +# Visit https://aka.ms/teamsfx-actions for details on actions +version: v1.2 + +additionalMetadata: + sampleTag: Microsoft-Teams-Samples:msgext-message-reminder-python + +environmentFolderPath: ./env diff --git a/samples/msgext-message-reminder/python/requirements.txt b/samples/msgext-message-reminder/python/requirements.txt new file mode 100644 index 0000000000..cb4f18628a --- /dev/null +++ b/samples/msgext-message-reminder/python/requirements.txt @@ -0,0 +1,6 @@ +requests==2.31.0 +botbuilder-integration-aiohttp>=4.14.5 +aiohttp>=3.8.0 +aiohttp-jinja2>=1.5.0 +jinja2>=3.0.0 +schedule==1.2.2 \ No newline at end of file diff --git a/samples/msgext-message-reminder/python/views/ScheduleTask.html b/samples/msgext-message-reminder/python/views/ScheduleTask.html new file mode 100644 index 0000000000..95fa8e993c --- /dev/null +++ b/samples/msgext-message-reminder/python/views/ScheduleTask.html @@ -0,0 +1,131 @@ + + + + + + + + + + Schedule Task + + + + + + + + + + + +
+
+
+ +
+ + +

+ + +
+ + +

+ + +
+ +

+ + +
+
+
+ + +