Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit e901f2d

Browse files
committed
Merge branch 'rido/adaptivecards' into u/rido/update-to-agentssdk
2 parents 3f3b422 + 0b99aa2 commit e901f2d

6 files changed

Lines changed: 17 additions & 15 deletions

File tree

samples/javascript_nodejs/07.using-adaptive-cards/bots/adaptiveCardsBot.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
// @ts-check
55

6-
const { ActivityHandler, CardFactory } = require('botbuilder');
7-
6+
const { ActivityHandler, CardFactory } = require('@microsoft/agents-hosting');
7+
const { Activity } = require('@microsoft/agents-activity')
88
// Import AdaptiveCard content.
99
const FlightItineraryCard = require('../resources/FlightItineraryCard.json');
1010
const ImageGalleryCard = require('../resources/ImageGalleryCard.json');
@@ -29,7 +29,7 @@ class AdaptiveCardsBot extends ActivityHandler {
2929
this.onMembersAdded(async (context, next) => {
3030
const membersAdded = context.activity.membersAdded ?? [];
3131
for (let cnt = 0; cnt < membersAdded.length; cnt++) {
32-
if (membersAdded[cnt].id !== context.activity.recipient.id) {
32+
if (membersAdded[cnt].id !== context.activity.recipient?.id) {
3333
await context.sendActivity(`Welcome to Adaptive Cards Bot ${ membersAdded[cnt].name }. ${ WELCOME_TEXT }`);
3434
}
3535
}
@@ -40,10 +40,11 @@ class AdaptiveCardsBot extends ActivityHandler {
4040

4141
this.onMessage(async (context, next) => {
4242
const randomlySelectedCard = CARDS[Math.floor((Math.random() * CARDS.length - 1) + 1)];
43-
await context.sendActivity({
43+
await context.sendActivity(Activity.fromObject({
44+
type: 'message',
4445
text: 'Here is an Adaptive Card:',
4546
attachments: [CardFactory.adaptiveCard(randomlySelectedCard)]
46-
});
47+
}));
4748

4849
// By calling next() you ensure that the next BotHandler is run.
4950
await next();

samples/javascript_nodejs/07.using-adaptive-cards/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ const restify = require('restify');
1414
// Import required bot services.
1515
// See https://aka.ms/bot-services to learn more about the different parts of a bot.
1616
const {
17-
CloudAdapter,
18-
ConfigurationBotFrameworkAuthentication
19-
} = require('botbuilder');
17+
CloudAdapter, loadAuthConfigFromEnv
18+
} = require('@microsoft/agents-hosting');
2019

2120
const { AdaptiveCardsBot } = require('./bots/adaptiveCardsBot');
2221

23-
const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication(process.env);
22+
const botFrameworkAuthentication = loadAuthConfigFromEnv();
2423

2524
// Create adapter. See https://aka.ms/about-bot-adapter to learn more about adapters.
2625
const adapter = new CloudAdapter(botFrameworkAuthentication);
@@ -62,5 +61,6 @@ server.listen(process.env.port || process.env.PORT || 3978, function() {
6261
// Listen for incoming requests.
6362
server.post('/api/messages', async (req, res) => {
6463
// Route received a request to adapter for processing
64+
// @ts-ignore
6565
await adapter.process(req, res, (context) => bot.run(context));
6666
});

samples/javascript_nodejs/07.using-adaptive-cards/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"url": "https://github.com/Microsoft/BotBuilder-Samples.git"
1717
},
1818
"dependencies": {
19-
"botbuilder": "~4.23.0",
19+
"@microsoft/agents-hosting": "~1.0.0",
2020
"dotenv": "^8.2.0",
2121
"restify": "~10.0.0"
2222
},

samples/javascript_nodejs/44.prompt-for-user-input/bots/customPromptBot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// @ts-check
55

66
const Recognizers = require('@microsoft/recognizers-text-suite');
7-
const { ActivityHandler } = require('botbuilder');
7+
const { ActivityHandler } = require('@microsoft/agents-hosting');
88

99
// The accessor names for the conversation flow and user profile state property accessors.
1010
const CONVERSATION_FLOW_PROPERTY = 'CONVERSATION_FLOW_PROPERTY';

samples/javascript_nodejs/44.prompt-for-user-input/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ const {
1818
ConversationState,
1919
MemoryStorage,
2020
UserState,
21-
ConfigurationBotFrameworkAuthentication
22-
} = require('botbuilder');
21+
loadAuthConfigFromEnv
22+
} = require('@microsoft/agents-hosting');
2323

2424
// This bot's main dialog.
2525
const { CustomPromptBot } = require('./bots/customPromptBot');
@@ -34,7 +34,7 @@ server.listen(process.env.port || process.env.PORT || 3978, function() {
3434
console.log('\nTo talk to your bot, open the emulator select "Open Bot"');
3535
});
3636

37-
const botFrameworkAuthentication = new ConfigurationBotFrameworkAuthentication(process.env);
37+
const botFrameworkAuthentication = loadAuthConfigFromEnv()
3838

3939
// Create adapter.
4040
// See https://aka.ms/about-bot-adapter to learn more about how bots work.
@@ -74,5 +74,6 @@ adapter.onTurnError = async (context, error) => {
7474
// Listen for incoming requests.
7575
server.post('/api/messages', async (req, res) => {
7676
// Route received a request to adapter for processing
77+
// @ts-ignore
7778
await adapter.process(req, res, (context) => bot.run(context));
7879
});

samples/javascript_nodejs/44.prompt-for-user-input/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@microsoft/recognizers-text-suite": "1.1.4",
16-
"botbuilder": "~4.23.0",
16+
"@microsoft/agents-hosting": "~1.0.0",
1717
"dotenv": "^8.2.0",
1818
"restify": "~10.0.0"
1919
},

0 commit comments

Comments
 (0)