Skip to content

[TS]: Create Bot File Upload Basic Sample #1884

Open
YugalPradhan31 wants to merge 5 commits intomainfrom
v-ypradhan/bot-file-upload-nodejs
Open

[TS]: Create Bot File Upload Basic Sample #1884
YugalPradhan31 wants to merge 5 commits intomainfrom
v-ypradhan/bot-file-upload-nodejs

Conversation

@YugalPradhan31
Copy link
Contributor

No description provided.

@YugalPradhan31 YugalPradhan31 changed the title Bot file upload sample in Node.js [TS]: Updating the Bot file upload sample with Teams SDK Jan 28, 2026
@YugalPradhan31 YugalPradhan31 changed the title [TS]: Updating the Bot file upload sample with Teams SDK [TS]: Create Bot File Upload Basic Sample Jan 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request creates a new TypeScript bot file upload sample using the modern Teams SDK (@microsoft/teams.apps), replacing the old JavaScript implementation that used Bot Framework v4.

Changes:

  • Removes the old Bot Framework v4-based JavaScript implementation
  • Adds a new TypeScript sample using @microsoft/teams.apps SDK
  • Updates sample metadata and documentation

Reviewed changes

Copilot reviewed 35 out of 46 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
samples/bot-file-upload/nodejs/bot-file-upload/index.ts New TypeScript implementation with Teams SDK handlers for file upload/download
samples/bot-file-upload/nodejs/bot-file-upload/package.json New package configuration for TypeScript sample
samples/bot-file-upload/nodejs/bot-file-upload/README.md Documentation for the new TypeScript sample
samples/bot-file-upload/nodejs/bot-file-upload/assets/sample.json Updated sample metadata
samples/bot-file-upload/nodejs/bot-file-upload/.env Environment configuration template
samples/bot-file-upload/nodejs/* (deleted files) Removed old Bot Framework v4 implementation and configuration
Comments suppressed due to low confidence (1)

samples/bot-file-upload/nodejs/bot-file-upload/assets/sample.json:12

  • The creationDateTime and updateDateTime are set to future dates (2026-01-28). According to the internal knowledge, the current date is January 29, 2026, but setting the creationDateTime to 2026-01-28 for a new sample is problematic. The creationDateTime should reflect when the sample was originally created or use a realistic past date.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still want to keep the bot-file-upload sample- we'll move it into an archived folder

"title": "Bot File Upload",
"shortDescription": "This bot sample for Teams demonstrates file upload capabilities using Bot Framework v4, enabling users to upload files and view inline images within chats.",
"url": "https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-file-upload/nodejs",
"title": "Bot Cards",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Bot Cards and Attaachments

"url": "https://raw.githubusercontent.com/OfficeDev/Microsoft-Teams-Samples/main/samples/bot-file-upload/nodejs/Images/FileUpload.gif",
"alt": "Solution UX showing file upload using bot"
"url": "https://raw.githubusercontent.com/OfficeDev/Microsoft-Teams-Samples/main/samples/bot-cards/bot-cards.gif",
"alt": "Solution UX showing various card types and actions in bot"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

various card types, actions, and attachments

@@ -0,0 +1,28 @@
# Bot Cards - Node.js (TypeScript)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Bot Quickstart - TypeScript

@@ -0,0 +1,28 @@
# Bot Cards - Node.js (TypeScript)

This sample demonstrates various card types and actions for Microsoft Teams using Node.js and TypeScript.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

various card types, actions, and attachments

await sendToggleVisibilityCard(context);
}
// Handle color input
else if (normalizedText.includes('red')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can completely remove the colour input logic

await context.send(`<b>${file.name}</b> received and saved.`);
} catch (error: any) {
console.error('Error downloading file:', error);
await context.send(`Error downloading file: ${error.message}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets not send again upon an error

});
} catch (error: any) {
console.error('Error sending file card:', error);
await context.send(`Error sending file card: ${error.message}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove send in catch

});
} catch (error: any) {
console.error('Error processing inline image:', error);
await context.send(`Error processing image: ${error.message}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove send in catch


const FILES_DIR = 'files';
const app = new App();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is very large and messy. can we somehow isolate the logic into different files:

  • handling the file uploading + attachments
  • handling the suggested actions
  • handling the cards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants