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 Teams Toolkit to make and deploy the bot.
I’m stuck trying to send video attachments from Airtable to the bot. I’ve tried a few things:
- Used the
getInternetAttachment
function, but got an Unknown attachment type
error.
- Changed
supportsFile
to true in the manifest file. Didn’t help.
- Tried making a video card, but got a
Malformed Video card
error.
Here’s how I’m getting files from Airtable:
const records = await base(course_tn).select({
view: 'Grid view'
}).all();
records.forEach(async (record) => {
let attachments = record.get('Attachments');
console.log(attachments);
const message = { type: ActivityTypes.Message };
message.attachments = [await createVideoAttachment(attachments.url)];
await turnContext.sendActivity(message);
});
Everything works fine in the Bot Framework Emulator. How can I fix this and send video attachments from Airtable to my Teams bot?
have u tried using the adaptivecard instead? i had similar probs with video attachments & switching to adaptivecard solved it for me. u can embed the video url in the card & it shud work. also, make sure ur airtable url is publicly accessible, that tripped me up b4.
I’ve faced similar challenges when working with video attachments in Teams bots. One approach that worked for me was using the MessageFactory to create a video message. Here’s a snippet that might help:
const { MessageFactory } = require('botbuilder');
// Inside your bot logic
const videoUrl = attachments[0].url;
const videoMessage = MessageFactory.contentUrl(videoUrl, 'video/mp4', 'Video Title', 'Video Description');
await turnContext.sendActivity(videoMessage);
Make sure the video URL from Airtable is directly accessible. If it’s not, you might need to implement a proxy or use Airtable’s attachment API to get a download URL.
Also, double-check your bot’s channel data configuration in Azure. Sometimes, permissions issues can cause attachment problems. If all else fails, you could try uploading the video to a service like Azure Blob Storage first, then sending the public URL from there.