Search code examples
node.jsbotframework

In Microsoft Bot Framework, how do I send a msg with a table format?


I am trying to create a msg to send to the user:

var msg = new Builder.Message().address(messageAddress);
msg.addAttachment(??);

bot.send(msg, (err)=>{
    if(err){
        reject(err);
    }
    resolve();
});

How do I add a table to my msg?

Example of a table:

enter image description here


Solution

  • I was able to this to work based on the answer of stackoverflow.com/a/48160573/2884059 .

    var msg: Builder.Message = new Builder.Message(session);
    msg.addAttachment({
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content":{
            "type": "AdaptiveCard",
            "version": "1.0",
            "body": [
                {
                    "type": "ColumnSet",
                    "columns": columnSet
                }
            ]
        }
    });
    session.endDialog(msg);