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

Bot Proactive message TeamsFx Sample Fixes #1474

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions samples/bot-proactive-messaging-teamsfx/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"access": "public",
"writeToEnvironmentFile": {
// Keep consistency with upgraded configuration.
"endpoint": "PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT",
"domain": "PROVISIONOUTPUT__BOTOUTPUT__VALIDDOMAIN"
"endpoint": "PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT",
"domain": "PROVISIONOUTPUT_BOTOUTPUT_VALIDDOMAIN"
}
}
],
Expand Down
6 changes: 3 additions & 3 deletions samples/bot-proactive-messaging-teamsfx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ This sample bot showcases proactive messaging capabilities in Microsoft Teams by
- Install [dev tunnel cli](https://aka.ms/teamsfx-install-dev-tunnel).
- Login with your M365 Account using the command `devtunnel user login`.
- Start your local tunnel service by running the command `devtunnel host -p 3978 --protocol http --allow-anonymous`.
- In the `env/.env.local` file, fill in the values for `PROVISIONOUTPUT__BOTOUTPUT__VALIDDOMAIN` and `PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT` with your dev tunnel URL.
- In the `env/.env.local` file, fill in the values for `PROVISIONOUTPUT_BOTOUTPUT_VALIDDOMAIN` and `PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT` with your dev tunnel URL.
```
PROVISIONOUTPUT__BOTOUTPUT__VALIDDOMAIN=sample-id-3978.devtunnels.ms
PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT=https://sample-id-3978.devtunnels.ms
PROVISIONOUTPUT_BOTOUTPUT_VALIDDOMAIN=sample-id-3978.devtunnels.ms
PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT=https://sample-id-3978.devtunnels.ms
```
- Executing the command `teamsapp provision --env local` in your project directory.
- Executing the command `teamsapp deploy --env local` in your project directory.
Expand Down
4 changes: 2 additions & 2 deletions samples/bot-proactive-messaging-teamsfx/aad.manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "${{AAD_APP_OBJECT_ID}}",
"name": "${{CONFIG__MANIFEST__APPNAME__SHORT}}-aad",
"name": "${{CONFIG_APPNAME_SHORT}}-aad",
"accessTokenAcceptedVersion": 2,
"signInAudience": "AzureADMyOrg",
"optionalClaims": {
Expand Down Expand Up @@ -93,7 +93,7 @@
],
"replyUrlsWithType": [
{
"url": "${{PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT}}/auth-end.html",
"url": "${{PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT}}/auth-end.html",
"type": "Web"
}
]
Expand Down
10 changes: 5 additions & 5 deletions samples/bot-proactive-messaging-teamsfx/appPackage/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"outline": "resources/outline.png"
},
"name": {
"short": "${{CONFIG__APPNAME__SHORT}}",
"full": "${{CONFIG__MANIFEST__APPNAME__FULL}}"
"short": "${{CONFIG_APPNAME_SHORT}}",
"full": "${{CONFIG_MANIFEST_APPNAME_FULL}}"
},
"description": {
"short": "Bot sample for proactive notifications ${{CONFIG__MANIFEST__APPNAME__SHORT}}",
"full": "This bot sends proactive reminders by saving conversation references in Teams. ${{CONFIG__MANIFEST__APPNAME__SHORT}}"
"short": "Bot sample for proactive notifications ${{CONFIG_APPNAME_SHORT}}",
"full": "This bot sends proactive reminders by saving conversation references in Teams. ${{CONFIG_APPNAME_SHORT}}"
},
"accentColor": "#FFFFFF",
"bots": [
Expand Down Expand Up @@ -61,6 +61,6 @@
"messageTeamMembers"
],
"validDomains": [
"${{PROVISIONOUTPUT__BOTOUTPUT__VALIDDOMAIN}}"
"${{PROVISIONOUTPUT_BOTOUTPUT_VALIDDOMAIN}}"
]
}
4 changes: 2 additions & 2 deletions samples/bot-proactive-messaging-teamsfx/bot/teamsBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TeamsBot extends TeamsActivityHandler {

for (let cnt = 0; cnt < membersAdded.length; cnt++) {
if (membersAdded[cnt].id !== context.activity.recipient.id) {
const welcomeMessage = `Welcome to the Proactive Bot sample. Navigate to ${process.env.PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT}/api/notify to proactively message everyone who has previously messaged this bot.`;
const welcomeMessage = `Welcome to the Proactive Bot sample. Navigate to ${process.env.PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT}/api/notify to proactively message everyone who has previously messaged this bot.`;
await context.sendActivity(welcomeMessage);
}
}
Expand All @@ -38,7 +38,7 @@ class TeamsBot extends TeamsActivityHandler {
this.addConversationReference(context.activity);

// Echo back what the user said
await context.sendActivity(`You sent '${context.activity.text}'. Navigate to ${process.env.PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT}/api/notify to proactively message everyone who has previously messaged this bot.`);
await context.sendActivity(`You sent '${context.activity.text}'. Navigate to ${process.env.PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT}/api/notify to proactively message everyone who has previously messaged this bot.`);
await next();
});

Expand Down
12 changes: 6 additions & 6 deletions samples/bot-proactive-messaging-teamsfx/env/.env.local
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This file includes environment variables that can be committed to git. It's gitignored by default because it represents your local development environment.
TEAMSFX_ENV=local
APP_NAME_SUFFIX=local
CONFIG__MANIFEST__APPNAME__SHORT=ProactiveMessagesTeamsFx
CONFIG__MANIFEST__APPNAME__FULL=Full name for ProactiveMessagesTeamsFx
CONFIG__MANIFEST__DESCRIPTION__SHORT=Short description of ProactiveMessagesTeamsFx
CONFIG__MANIFEST__DESCRIPTION__FULL=Full description of ProactiveMessagesTeamsFx
CONFIG__MANIFEST__ICONS__COLOR=resources/color.png
CONFIG__MANIFEST__ICONS__OUTLINE=resources/outline.png
CONFIG_APPNAME_SHORT=ProactiveMessagesTeamsFx
CONFIG_MANIFEST_APPNAME_FULL=Full name for ProactiveMessagesTeamsFx
CONFIG_MANIFEST_DESCRIPTION_SHORT=Short description of ProactiveMessagesTeamsFx
CONFIG_MANIFEST_DESCRIPTION_FULL=Full description of ProactiveMessagesTeamsFx
CONFIG_MANIFEST_ICONS_COLOR=resources/color.png
CONFIG_MANIFEST_ICONS_OUTLINE=resources/outline.png
8 changes: 4 additions & 4 deletions samples/bot-proactive-messaging-teamsfx/teamsapp.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ provision:

- uses: botAadApp/create # Creates a new AAD app for bot if BOT_ID environment variable is empty
with:
name: ${{CONFIG__MANIFEST__APPNAME__SHORT}}-bot
name: ${{CONFIG_APPNAME_SHORT}}-bot
writeToEnvironmentFile:
botId: BOT_ID
botPassword: SECRET_BOT_PASSWORD
Expand All @@ -25,8 +25,8 @@ provision:
- uses: botFramework/create
with:
botId: ${{BOT_ID}}
name: ${{CONFIG__MANIFEST__APPNAME__SHORT}}-bot
messagingEndpoint: ${{PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT}}/api/messages
name: ${{CONFIG_APPNAME_SHORT}}-bot
messagingEndpoint: ${{PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT}}/api/messages
description: ""
channels:
- name: msteams
Expand Down Expand Up @@ -59,7 +59,7 @@ deploy:
with:
target: ./bot/.env.teamsfx.local
envs:
INITIATE_LOGIN_ENDPOINT: ${{PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT}}/auth-start.html
INITIATE_LOGIN_ENDPOINT: ${{PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT}}/auth-start.html
M365_APPLICATION_ID_URI: api://botid-${{BOT_ID}}

# Run npm command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ resource botWebAppSettings 'Microsoft.Web/sites/config@2021-02-01' = {
BOT_ID: botId // ID of your bot
BOT_PASSWORD: botAadAppClientSecret // Secret of your bot
IDENTITY_ID: provisionOutputs.identityOutput.value.identityClientId // User assigned identity id, the identity is used to access other Azure resources
PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT : provisionOutputs.botOutput.value.siteEndpoint // Site endpoint of AAD application
PROVISIONOUTPUT_BOTOUTPUT_SITEENDPOINT : provisionOutputs.botOutput.value.siteEndpoint // Site endpoint of AAD application
}, currentAppSettings)
}