Trouble attaching videos from Airtable to Microsoft Teams bot

I’m working on a Microsoft Teams bot using Node.js and Bot Framework SDK. The bot gets info from Airtable and sends it to Teams. I’m using VS Code with the Teams Toolkit extension.

I can’t figure out how to send video attachments from Airtable to the bot. I’ve tried a few things:

  1. Used the getInternetAttachment function, but got an ‘Unknown attachment type’ error.
  2. Set supportsFile:true in the manifest file. Didn’t help.
  3. Tried making a video card, but got a ‘Malformed Video card’ error.

Here’s how I’m getting the attachments from Airtable:

const records = await base(course_tn).select({
  view: 'Grid view'
}).all();

records.forEach(async function(record) {
  let files = record.get('Attachments');
  console.log(files);
  const reply = { type: ActivityTypes.Message };
  reply.attachments = [await getVideoAttachment(files.url)];
  await turnContext.sendActivity(reply);
});

function getVideoAttachment(fileUrl) {
  return {
    name: 'video.mp4',
    contentType: 'video/mp4',
    contentUrl: fileUrl
  };
}

Everything works fine in the Bot Framework emulator. How can I get these videos to show up in the actual Teams bot?

I encountered a similar issue when working with video attachments in Teams bots. One approach that worked for me was using the Azure Blob Storage to host the videos. Here’s what I did:

  1. Upload the videos from Airtable to Azure Blob Storage.
  2. Generate a SAS token for secure access to the videos.
  3. Use the blob URL with SAS token in the attachment’s contentUrl.

This method ensures the videos are accessible to Teams and bypasses some of the issues with direct Airtable URLs. You’ll need to modify your getVideoAttachment function to use the Azure Blob URL instead.

Also, double-check that your bot’s Azure App Service plan supports video streaming. Some lower-tier plans might have limitations on media content delivery.

have u tried using the VideoCard class from botframework-schema? it worked for me when i had a similar issue. create a VideoCard object with the url and other details, then wrap it in an Attachment. might need to tweak the contentUrl format tho. lmk if u need more help!

I encountered similar issues when working with external video content for Teams bots. My solution was to use adaptive cards instead of sending direct video attachments. I created an adaptive card that includes a media element and set its media source to the Airtable video URL. This method resolved the ‘Unknown attachment type’ issue and allowed the video to display correctly in Teams. Adjusting the getVideoAttachment function to return the adaptive card structure was crucial. Also, make sure that the Airtable URLs are accessible or that proper authentication is in place if needed.