Botframework-sdk: NodeJs botbuilder: IntentDialog.recognize() can't recognize command posted from Skype group

Created on 29 Jul 2016  路  6Comments  路  Source: microsoft/botframework-sdk

Hello, everyone.

I'm using NodeSDK botbuilder 3.1.1.
When I send a message from Skype group to the Bot he receives the message like this:
<at id=\"28:74e0ce5a-1742-4540-9abe-ce07ca95a07c\">@SchedulerBot</at> start

As I registered IntentDialog, during IntentDialog.prototype.recognize call he tries to find out whether this message matches one of the given RegExps.

In my code there's an entry on intent dialog:
intents.matches(/(\/)?start/gi, [ ...

However Bot fails to recognize this entrypoint because the mention tag in the message is too big and so the if statement returns 'false' value:

IntentDialog.js, line.107 (botbuilder 3.1.1)
if (score > result.score && score >= this.options.intentThreshold) {
score = 0.066666666;
options.intentThreshold = 0.1;

So Bot goes to "onDefault" method instead of my expected entrypoint. Bot works perfectly in 1:1 conversations, even works on Telegram, but in Skype it's like so.

Thanks for your time guys.

Most helpful comment

Hello, @librevyas just pass a JSON with options to IntentDialog during instantiation, would look similar to this:

const intents = new botBuilder.IntentDialog({ intentThreshold: 0.7 });

All 6 comments

Just to note one thing, I understand I can modify intentThreshold option during creation of IntentDialog instance let's say to 0.01. However it's confusing to me that messages contain 'mentioned' tag in message text and also having this information in a JSON entities property. But maybe I'm missing something and this is the desired behavior.

yes, I have the same problem. And even when I click on a card's button, it sends:
<at id=\"28:.....\">@MyBot</at> action?order=coke
This message's sent by bot itself via this:
builder.CardAction.dialogAction(session, "order", "coke", "I'd like a coke!")
It shows the default action too.
Should the tagging part be removed to make the patterns consistent with both direct & group chat?

Fixed this issue for me by adding a custom Middleware processor, which looks like this:

botBuilder.Middleware.convertSkypeGroupMessages = function() {
    return {
        botbuilder: function (session, next) {
            let message = session.message;
            let address = message.address;
            if (address.channelId === "skype" && address.conversation.isGroup) {
                if (message.entities.length > 0) {
                    let content = message.text;

                    message.entities.forEach((entity) => {
                        content = message.text.replace(entity.text, '');
                    });

                    session.message.text = content.trim();
                }
            }

            next();
        }
    }
};

// ...

// convert skype group messages till better times
bot.use(botBuilder.Middleware.convertSkypeGroupMessages());

Now I can write messages to my bot, and all entities of "mention" type are removed from original text so I get only a command without tags.

I just close this ticket as there's no activity here.

Hi ,
I want to know how to use intentThreshold .i just want to make sure that only intent with a score > 0.7 should be triggered.

Hello, @librevyas just pass a JSON with options to IntentDialog during instantiation, would look similar to this:

const intents = new botBuilder.IntentDialog({ intentThreshold: 0.7 });

It works. @alisiikh Thanks man :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daveta picture daveta  路  3Comments

Vigneshramkumar picture Vigneshramkumar  路  3Comments

clearab picture clearab  路  3Comments

verdysh picture verdysh  路  3Comments

mattlanham picture mattlanham  路  3Comments