I’m building a chatbot for Microsoft Teams using the Bot Framework SDK with Node.js. The bot pulls data from an Airtable database and displays it in Teams. I’m using the Teams Toolkit extension in VS Code for development and deployment.
The main issue: I can’t get video files from Airtable to show up properly in the Teams bot.
What I’ve tried so far:
Method 1 - Direct attachment approach:
async function createMediaAttachment(video_url) {
return {
name: "video.mp4",
contentType: "video/mp4",
contentUrl: video_url
};
}
This throws an Unknown attachment type error.
Method 2 - Updated manifest settings:
I set supportsFile: true in the manifest.json file but it didn’t change anything.
Method 3 - Video card creation:
async function buildVideoCard(cardTitle, videoUrl) {
return CardFactory.videoCard(
cardTitle,
[{ "url": videoUrl }],
[{
"type": 'openUrl',
"title": 'Watch More',
"value": 'https://example.com'
}],
{
"subtitle": 'Sample Video',
"text": 'This is a test video from our database'
}
);
}
await context.sendActivity({ attachments: [await buildVideoCard(title, url)] });
This gives me a Malformed Video card - Invalid aspect value error.
How I’m getting files from Airtable:
const data = await database(table_name).select({
view: "Main view"
}).all();
data.forEach(async function (item) {
mediaFiles = item.get("Media");
console.log(mediaFiles);
const message = { type: ActivityTypes.Message };
message.attachments = [await createMediaAttachment(mediaFiles.url)];
context.sendActivity(message);
});
Sample output from Airtable:
[
{
id: 'attXyz123AbC',
url: video_file_url,
filename: 'TestVideo_720p_5mb.mp4',
size: 5242880,
type: 'video/mp4'
}
]
All these methods work fine when I test them in the Bot Framework Emulator, but they fail when deployed to actual Teams. Has anyone dealt with this before? What’s the right way to handle video attachments from Airtable in Teams bots?