MS Teams bot video file transfer from Airtable database not working

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?

This is a common Teams bot issue. Teams needs specific content type headers and auth tokens for video attachments - Airtable URLs don’t provide these by default.

I fixed this with a middleware approach: instead of passing Airtable URLs directly, I created a handler that downloads the video temporarily to local storage, then serves it with proper Teams headers. You’ll need auth headers and correct MIME types.

Alternatively, check if your Airtable URLs have access tokens. Sometimes Teams just can’t authenticate with Airtable’s CDN. I had to modify my API calls to include bearer tokens in the video URLs before Teams would accept them. The Bot Framework Emulator is way more forgiving than actual Teams deployment.

I hit the same issue with file attachments in Teams bots. Teams blocks your Airtable URLs because they don’t meet Teams’ content security requirements - it’s way stricter than the Bot Framework Emulator.

I fixed it by adding a proxy endpoint to my bot service. Create a route like ‘/api/video/:id’ that grabs the file from Airtable and streams it back with the right CORS headers and content disposition. Teams won’t accept Airtable’s default headers.

Easier solution though - just upload your videos to Azure Blob Storage or SharePoint instead, then store those URLs in Airtable. These services are already whitelisted by Teams and handle all the security stuff automatically. Way more reliable in my experience.

Teams has weird video card requirements that aren’t documented well. Try setting the aspect ratio explicitly in your video card - add aspect: '16:9' or aspect: '4:3' to the card options. Also make sure your Airtable video URLs are HTTPS not HTTP. Teams will reject HTTP content silently without proper error messages. Had this bite me before.