Wolke / botbuilder-linebot-connector

MIT License
88 stars 16 forks source link

No way to send message using session.send #6

Closed FuyukiSakura closed 6 years ago

FuyukiSakura commented 6 years ago

I keep having this error saying

Error: no way to send message: [object Object]
    at D:\home\site\wwwroot\node_modules\botbuilder-linebot-connector\line\LineConnector.js:748:23
    at Array.map (native)
    at LineConnector.send (D:\home\site\wwwroot\node_modules\botbuilder-linebot-connector\line\LineConnector.js:727:18)
    at D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\UniversalBot.js:218:31
    at UniversalBot.tryCatch (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\UniversalBot.js:516:13)
    at D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\UniversalBot.js:212:23
    at D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\UniversalBot.js:536:17
    at D:\home\site\wwwroot\node_modules\async\lib\async.js:52:16
    at replenish (D:\home\site\wwwroot\node_modules\async\lib\async.js:314:29)
    at D:\home\site\wwwroot\node_modules\async\lib\async.js:326:29

Using the sample code provided in readme.

bot.on('conversationUpdate', function (message) {
    // detect event
    switch (message.text) {
        case 'follow':
            break;
        case 'unfollow':
            break;
        case 'join':
            break;
        case 'leave':
            break;
    }
    var isGroup = message.address.conversation.isGroup;
    var txt = isGroup ? "Hello everyone!" : "Hello " + message.from.name;
    var reply = new builder.Message()
        .address(message.address)
        .text(txt);
    bot.send(reply);
    bot.beginDialog(message.address, "hello")
});

bot.dialog("hello", [
    s => {
        builder.Prompts.text(s, "go");
    },
    (s, r) => {
        s.send("oh!" + r.response)
        s.endDialog()
    }
])

The first message Hello <<username>> is replied to my Line account correctly. So I expect that my Line settings are hooked correctly.

FYI, the App is hosted on Azure.

FuyukiSakura commented 6 years ago

It turns out that it was because I was using Microsoft's template for bot builder where they have configured bot builder for tableStorage
The connector works like charm after removing that line.