diff --git a/samples/bot-task-module/nodejs/index.js b/samples/bot-task-module/nodejs/index.js index 82b51e4eab..379ba6c602 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('/getAppConfig', (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..6d8076ee45 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..4640ea62bd 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}/getAppConfig`).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 @@

- +