Botbuilder不向用户提供souch可下载文件。但是,您可以在
express
或
restify
您可以尝试以下代码段:
let hostUrl = `http://localhost:3978`;
var bot = new builder.UniversalBot(connector, [
(session) => {
session.send({
text:'downliad file',
attachments: [{
contentUrl: `${hostUrl}/xlsx`,
name: 'test.xlsx'
}]
})
}
]);
server.get('/xlsx', (req, res, next) => {
const request = require('request');
request.get(`<the excel api you get from>`).pipe(res);
})