From 4542b9ff2f962f92df435d5bf3020e9bc13bb4cc Mon Sep 17 00:00:00 2001 From: Harikrishnan Rajandiran Date: Fri, 30 Jun 2023 15:24:26 +0530 Subject: [PATCH 1/2] Fixed Bot-Task-Module Sample Issues --- samples/bot-task-module/nodejs/index.js | 7 +++++++ .../bot-task-module/nodejs/pages/CustomForm.html | 6 ++++-- .../bot-task-module/nodejs/pages/TaskModuleTab.js | 13 +++++++------ .../bot-task-module/nodejs/pages/taskmodule.html | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/samples/bot-task-module/nodejs/index.js b/samples/bot-task-module/nodejs/index.js index 82b51e4eab..5e28d8429d 100644 --- a/samples/bot-task-module/nodejs/index.js +++ b/samples/bot-task-module/nodejs/index.js @@ -67,3 +67,10 @@ server.post('/api/messages', async (req, res) => { server.get('/*', restify.plugins.serveStatic({ directory: './pages' })); + +server.get('/AuthTab', (req, res,next) => { + var responseMessageData = { + MicrosoftAppId: process.env.MicrosoftAppId + } + res.send(responseMessageData); + }); \ No newline at end of file diff --git a/samples/bot-task-module/nodejs/pages/CustomForm.html b/samples/bot-task-module/nodejs/pages/CustomForm.html index aedfa65746..6266fe03a2 100644 --- a/samples/bot-task-module/nodejs/pages/CustomForm.html +++ b/samples/bot-task-module/nodejs/pages/CustomForm.html @@ -9,7 +9,7 @@ -
+
@@ -27,12 +27,14 @@ diff --git a/samples/bot-task-module/nodejs/pages/TaskModuleTab.js b/samples/bot-task-module/nodejs/pages/TaskModuleTab.js index bf5396f59d..d2f97bfc9d 100644 --- a/samples/bot-task-module/nodejs/pages/TaskModuleTab.js +++ b/samples/bot-task-module/nodejs/pages/TaskModuleTab.js @@ -1,15 +1,15 @@ //- Copyright (c) Microsoft Corporation. //- All rights reserved. - // microsoftTeams app Initilize -microsoftTeams.app.initialize().then(() => { + microsoftTeams.app.initialize().then(() => { var taskModuleButtons = document.getElementsByClassName("taskModuleButton"); if (taskModuleButtons.length > 0) { + fetch(`${window.location.origin}/AuthTab`).then(response => response.json()).then(data => { //config your appid and baseurl var config = { - MicrosoftAppID: "<>", - BaseUrl: "<>" + MicrosoftAppID: data.MicrosoftAppId, + BaseUrl: `${window.location.origin}` } var taskInfo_1 = { @@ -221,7 +221,7 @@ microsoftTeams.app.initialize().then(() => { }; //Allows app to open a url based dialog. - microsoftTeams.dialog.open(taskInfo_1, submitHandler); + microsoftTeams.tasks.startTask(taskInfo_1, submitHandler); break; case TaskModuleIds.AdaptiveCard1: @@ -249,5 +249,6 @@ microsoftTeams.app.initialize().then(() => { console.log("URL: " + taskInfo_1.url); }); } + }); } -}); +}); \ No newline at end of file diff --git a/samples/bot-task-module/nodejs/pages/taskmodule.html b/samples/bot-task-module/nodejs/pages/taskmodule.html index 8d7b22b609..745ad84bca 100644 --- a/samples/bot-task-module/nodejs/pages/taskmodule.html +++ b/samples/bot-task-module/nodejs/pages/taskmodule.html @@ -34,7 +34,7 @@

- +

From 3e013346642624bda19cf6ab9122d73c4876ef84 Mon Sep 17 00:00:00 2001 From: Harikrishnan Rajandiran Date: Fri, 30 Jun 2023 19:16:19 +0530 Subject: [PATCH 2/2] Fixed PR comments --- samples/bot-task-module/nodejs/index.js | 2 +- samples/bot-task-module/nodejs/pages/CustomForm.html | 2 +- samples/bot-task-module/nodejs/pages/TaskModuleTab.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/bot-task-module/nodejs/index.js b/samples/bot-task-module/nodejs/index.js index 5e28d8429d..379ba6c602 100644 --- a/samples/bot-task-module/nodejs/index.js +++ b/samples/bot-task-module/nodejs/index.js @@ -68,7 +68,7 @@ server.get('/*', restify.plugins.serveStatic({ directory: './pages' })); -server.get('/AuthTab', (req, res,next) => { +server.get('/getAppConfig', (req, res,next) => { var responseMessageData = { MicrosoftAppId: process.env.MicrosoftAppId } diff --git a/samples/bot-task-module/nodejs/pages/CustomForm.html b/samples/bot-task-module/nodejs/pages/CustomForm.html index 6266fe03a2..6d8076ee45 100644 --- a/samples/bot-task-module/nodejs/pages/CustomForm.html +++ b/samples/bot-task-module/nodejs/pages/CustomForm.html @@ -27,7 +27,7 @@