I’m building a chatbot for Microsoft Teams using the Bot Framework SDK with Node.js. The bot pulls data from our Airtable database and displays it in Teams chat. I’m using the Teams Toolkit extension in VS Code for development and deployment.
The Problem:
I can’t get video files to transfer properly from Airtable to the Teams bot. Here’s what I’ve tried so far:
Method 1 - Direct attachment approach:
Using a custom function to handle internet-based attachments, but getting Unknown attachment type
error.
async function fetchVideoAttachment(video_url) {
return {
name: "video.mp4",
contentType: "video/mp4",
contentUrl: video_url
};
}
Method 2 - Manifest configuration:
Set supportsFile: true
in the manifest.json file but no change in behavior.
Method 3 - Video card creation:
Tried building a video card but getting Malformed Video card - Invalid aspect value
error.
async function buildVideoCard(cardTitle, videoUrl) {
return CardFactory.videoCard(
cardTitle,
[{ "url": videoUrl }],
[{
"type": 'openUrl',
"title": 'Watch More',
"value": 'https://example.com/videos'
}],
{
"subtitle": 'Training Video',
"text": 'Educational content for team training purposes'
}
);
}
await context.sendActivity({ attachments: [await buildVideoCard(videoTitle, videoUrl)] })
How I’m getting files from Airtable:
const data = await database(table_name).select({
view: "Main view"
}).all();
data.forEach(async function (item) {
videoFiles = item.get("VideoFiles")
console.log(videoFiles)
const message = { type: ActivityTypes.Message };
message.attachments = [await fetchVideoAttachment(videoFiles.url)];
context.sendActivity(message)
})
Sample output from Airtable:
[
{
id: 'attXy9bzGldMnS7uD',
url: video_file_url,
filename: 'TrainingVideo_720p_8mb.mp4',
size: 8392841,
type: 'video/mp4'
}
]
All these methods work fine when I test in the Bot Framework emulator, but fail when deployed to actual Teams environment. What am I missing to make video attachments work properly in Teams?