Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Place Your Order' workflow bot sample #541

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"provisionParameters": {
"value": {
"botAadAppClientId": "{{state.teams-bot.botId}}",
"botAadAppClientSecret": "{{state.teams-bot.botPassword}}",
"resourceBaseName": "contosoresdev{{state.solution.resourceNameSuffix}}"
}
}
}
}
18 changes: 18 additions & 0 deletions place-your-order-workflow-bot/.fx/configs/config.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://aka.ms/teamsfx-env-config-schema",
"description": "You can customize the TeamsFx config for different environments. Visit https://aka.ms/teamsfx-env-config to learn more about this.",
"manifest": {
"appName": {
"short": "ContosoRestaurant",
"full": "Full name for ContosoRestaurant"
},
"description": {
"short": "Short description of ContosoRestaurant",
"full": "Full description of ContosoRestaurant"
},
"icons": {
"color": "resources/color.png",
"outline": "resources/outline.png"
}
}
}
58 changes: 58 additions & 0 deletions place-your-order-workflow-bot/.fx/configs/projectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"appName": "place-your-order-workflow-bot",
"version": "2.1.0",
"isFromSample": true,
"components": [
{
"name": "teams-bot",
"hosting": "azure-web-app",
"provision": false,
"deploy": true,
"capabilities": [
"workflow"
],
"build": true,
"folder": "bot"
},
{
"name": "bot-service",
"provision": true
},
{
"name": "azure-web-app",
"scenario": "Bot",
"connections": [
"identity",
"teams-bot"
]
},
{
"name": "identity",
"provision": true
}
],
"programmingLanguage": "typescript",
"solutionSettings": {
"name": "fx-solution-azure",
"version": "1.0.0",
"hostType": "Azure",
"azureResources": [],
"capabilities": [],
"activeResourcePlugins": [
"fx-resource-local-debug",
"fx-resource-appstudio",
"fx-resource-cicd",
"fx-resource-api-connector",
"fx-resource-bot",
"fx-resource-identity"
]
},
"pluginSettings": {
"fx-resource-bot": {
"host-type": "app-service",
"capabilities": [
"workflow"
]
}
}
}
10 changes: 10 additions & 0 deletions place-your-order-workflow-bot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TeamsFx files
node_modules
.fx/configs/localSettings.json
.fx/states/*.userdata
.DS_Store
.env.teamsfx.local
subscriptionInfo.json
build
.fx/configs/config.local.json
.fx/states/state.local.json
95 changes: 95 additions & 0 deletions place-your-order-workflow-bot/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Remote (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 2
},
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Remote (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 1
},
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Bot (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Bot (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen"
},
{
"name": "Attach to Bot",
"type": "pwa-node",
"request": "attach",
"port": 9239,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen"
}
],
"compounds": [
{
"name": "Debug (Edge)",
"configurations": [
"Launch Bot (Edge)",
"Attach to Bot"
],
"preLaunchTask": "Start Teams App Locally",
"presentation": {
"group": "all",
"order": 2
},
"stopAll": true
},
{
"name": "Debug (Chrome)",
"configurations": [
"Launch Bot (Chrome)",
"Attach to Bot"
],
"preLaunchTask": "Start Teams App Locally",
"presentation": {
"group": "all",
"order": 1
},
"stopAll": true
}
]
}
11 changes: 11 additions & 0 deletions place-your-order-workflow-bot/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"debug.onTaskErrors": "abort",
"json.schemas": [
{
"fileMatch": [
"/aad.*.json"
],
"schema": {}
}
]
}
122 changes: 122 additions & 0 deletions place-your-order-workflow-bot/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// This file is automatically generated by Teams Toolkit.
// The teamsfx tasks defined in this file require Teams Toolkit version >= 4.1.0.
// See https://aka.ms/teamsfx-debug-tasks for details on how to customize each task and how to integrate with existing Teams Toolkit projects.
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Teams App Locally",
"dependsOn": [
"Validate & install prerequisites",
"Install npm packages",
"Start local tunnel",
"Set up bot",
"Build & upload Teams manifest",
"Start services"
],
"dependsOrder": "sequence"
},
{
// Check if all required prerequisites are installed and will install them if not.
// See https://aka.ms/teamsfx-check-prerequisites-task to know the details and how to customize the args.
"label": "Validate & install prerequisites",
"type": "teamsfx",
"command": "debug-check-prerequisites",
"args": {
"prerequisites": [
"nodejs", // Validate if Node.js is installed.
"m365Account", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the sideloading permission.
"ngrok", // Install Ngrok. Bot project requires a public message endpoint, and ngrok can help create public tunnel for your local service.
"portOccupancy" // Validate available ports to ensure those debug ones are not occupied.
],
"portOccupancy": [
3978, // bot service port
9239 // bot inspector port for Node.js debugger
]
}
},
{
// Check if all the npm packages are installed and will install them if not.
// See https://aka.ms/teamsfx-npm-package-task to know the details and how to customize the args.
"label": "Install npm packages",
"type": "teamsfx",
"command": "debug-npm-install",
"args": {
"projects": [
{
"cwd": "${workspaceFolder}/bot",
"npmInstallArgs": [
"--no-audit"
]
}
]
}
},
{
// Start the local tunnel service to forward public ngrok URL to local port and inspect traffic.
// See https://aka.ms/teamsfx-local-tunnel-task to know the details and how to customize the args.
"label": "Start local tunnel",
"type": "teamsfx",
"command": "debug-start-local-tunnel",
"args": {
"ngrokArgs": "http 3978 --log=stdout --log-format=logfmt"
},
"isBackground": true,
"problemMatcher": "$teamsfx-local-tunnel-watch"
},
{
// Register resources and prepare local launch information for Bot.
// See https://aka.ms/teamsfx-debug-set-up-bot-task to know the details and how to customize the args.
"label": "Set up bot",
"type": "teamsfx",
"command": "debug-set-up-bot",
"args": {
//// Enter your own bot information if using the existing bot. ////
// "botId": "",
// "botPassword": "", // use plain text or environment variable reference like ${env:BOT_PASSWORD}
"botMessagingEndpoint": "/api/messages" // use your own routing "/any/path", or full URL "https://contoso.com/any/path"
}
},
{
// Build and upload Teams manifest.
// See https://aka.ms/teamsfx-debug-prepare-manifest-task to know the details and how to customize the args.
"label": "Build & upload Teams manifest",
"type": "teamsfx",
"command": "debug-prepare-manifest",
"args": {
//// Enter your own Teams app package path if using the existing Teams manifest. ////
// "appPackagePath": ""
}
},
{
"label": "Start services",
"dependsOn": [
"Start bot"
]
},
{
"label": "Start bot",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/bot"
},
"problemMatcher": {
"pattern": [
{
"regexp": "^.*$",
"file": 0,
"location": 1,
"message": 2
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "[nodemon] starting",
"endsPattern": "restify listening to|Bot/ME service listening at|[nodemon] app crashed"
}
}
}
]
}
Loading