无法在 BotFramework 中接收来自 Skype 的附件

Not able to receive an attachment from Skype in BotFramework

在 BotFramework (NodeJS) 上,我试图复制 https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-send-receive-attachments 上可用的演示。它实际上运作良好。

代码以防 ms 文章更改:

// Create your bot with a function to receive messages from the user
var bot = new builder.UniversalBot(connector, function (session) {
    var msg = session.message;
    if (msg.attachments && msg.attachments.length > 0) {
     // Echo back attachment
     var attachment = msg.attachments[0];
        session.send({
            text: "You sent:",
            attachments: [
                {
                    contentType: attachment.contentType,
                    contentUrl: attachment.contentUrl,
                    name: attachment.name
                }
            ]
        });
    } else {
        // Echo back users text
        session.send("You said: %s", session.message.text);
    }
});

但是,我面临的问题是,当我从 Skype(正常)拨打电话时,我收到一条错误消息:

2017-12-07T02:16:15.815Z Error: POST to 'https://smba.trafficmanager.net/apis/v3/conversations/<My Conversation>/activities' failed: [400] Bad Request
    at Request._callback (/app/node_modules/botbuilder/lib/bots/ChatConnector.js:545:46)
    at Request.self.callback (/app/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/app/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)

有什么想法吗?

[更新:它仅在我创建附件响应时发生。所以我想这就是我遇到问题的地方]

实际上 MS 网站上的代码不是最新的(在某种程度上)。

如果我遵循可见的代码:https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-ReceiveAttachment

例如,我可以接收附件并将其保存在 public 文件夹中的某个位置。完成后,我可以将 "public" URL 作为附件发回,然后就可以使用了。