0

I am developing an MS Teams bot using Bot Framework SDK in Node.js, the botfetches information from Airtable and send it to MS Teams bot. I am using VS Studio Code Teams Toolkit extension to create, provision and deploy the bot.

I am facing a problem sending video attachments from Airtable to the bot. I have tried the following methods

  1. getInternetAttachment function from BotBuilder's GitHub repository but it gives Unknown attachment type error.
async function getInternetAttachment(file_url) {
    
        // NOTE: The contentUrl must be HTTPS.
        return {
            name: "file.mp4",
            contentType: "video/mp4,
            contentUrl: file_url 
        };
    }


  1. I have changed the value of supportsFile:true in manifest.json. Didn't have any affect on the bot.

  2. I have tried creating a video card but it gives Malformed Video card - Invalid aspect value error

    async function createVideoCard(title, url) {
    
        return CardFactory.videoCard(
            title,
            [{ "url": url }],
            [{
                "type": 'openUrl',
                "title": 'Lean More',
                "value": 'https://channel9.msdn.com/Events/Imagine-Cup/World-Finals-2018/2018-Imagine-Cup-World-Championship-Intro'
            }],
            {
                "subtitle": 'by Microsoft',
                "text": 'Microsoft\'s Imagine Cup has empowered student developers around the world to create and innovate on the world stage for the past 16 years. These innovations will shape how we live, work and play.'
            }
    
    
        );
    
    }

await turnContext.sendActivity({ attachments: [await createVideoCard(title, url)] })

Fetching attachments from Airtable:

const records = await base(course_tn).select({
      
        view: "Grid view",

    }).all(
    );
    
   records.forEach(async function (record) {
            files= record.get("Attachments") //Attachments is the field name
            console.log(files) 
            const reply = { type: ActivityTypes.Message };
            reply.attachments = [await getInternetAttachment(files.url)];
            turnContext.sendActivity(reply)
 })

Output:

[
  {
    id: 'attAm7ezFldMnS7uC',
    url: file_url,
    filename: 'SampleVideo_1280x720_10mb.mp4',
    size: 10498677,
    type: 'video/mp4'
  }
]

Airtable API reference: https://support.airtable.com/hc/en-us/articles/203313985-Public-REST-API

Each method and code runs successfully in the Bot Framework emulator. How can I resolve this and successfully send video attachments from Airtable to MS Teams bot?

Dummy Cron
  • 143
  • 2
  • 11
  • Can you please elaborate what exactly Airtable and how are you sending attachment from Airtable to Teams bot? – ChetanSharma-msft Aug 01 '22 at 08:23
  • Airtable is where I am storing my content. I pass files.url value from the Airtable function to getInternetAttachement's file_url argument – Dummy Cron Aug 01 '22 at 09:43
  • Looks like your videoCard is not created properly. Could you please re-verify your card URL's and configuration once. I hope you are using this doc: https://learn.microsoft.com/en-us/javascript/api/botbuilder-core/cardfactory?view=botbuilder-ts-latest#botbuilder-core-cardfactory-videocard – ChetanSharma-msft Aug 01 '22 at 18:18
  • Yes, I did.Works fine in Bot Framework Emulator. – Dummy Cron Aug 02 '22 at 03:49
  • We are try to repro using the below sample, It's working fine from our end. https://youtu.be/IbFYkF2DOYA Refer sample-https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/56.teams-file-upload – Sayali-MSFT Aug 04 '22 at 10:22
  • how did you fetch your video file? – Dummy Cron Aug 05 '22 at 12:37
  • Storing a file in one folder and access using the below code- string filename = "05.04.2022_18.37.55_REC.mp4"; string filePath = Path.Combine("Files", filename); long fileSize = new FileInfo(filePath).Length; await SendFileCardAsync(turnContext, filename, fileSize, cancellationToken); – Sayali-MSFT Aug 08 '22 at 12:32

0 Answers0