03-07-2018 06:38 AM
Hi,
during my trials to get the BOT SDK up and running and creating some Bots I was facing the problem that the Bot didn't act on @BotName (direct_mention) in a group-chat.
During the debugging I found the cause to be the case sensitive search for the jids:
function findBotJid(jid) {
return jid === bot.client_jid;
}
function IsBotMentioned(message)
{
let mention_jids = ExtractMentionJids(message);
if (mention_jids.find(findBotJid))
{
return true;
}
return false;
}
So if the jid you use to register the Bot is not exactly the same as the one configured on IM&P/CUCM, especially if it differs in upper/lower case letters then the Bot will never trigger for any @mentioned messages.
var bot = botCTRL.spawn({
client: {
jid: 'jabberbot@company.com',
password: 'super-secret',
host: "im&p-host@company.com",
port: 5222
}
});
It took me quite some time to figure this out, especially as I wasn't able to get the group-chat working in the SandBox you provide: NEW Sandbox! Jabber Client 12.0 w/ Jabber Bot SDK!
After I found the problem, I checked the RFCs and other sources on the web, but unfortunately I couldn't get a clear statement if the JIDs are case-sensitive or not.
So you might consider either making the search case-insensitive:
function findBotJid(jid) {
return jid.toLowerCase() === bot.client_jid.toLowerCase();
}
... or at least adapt the documentation to mention this pitfall.
Besides that it's working great and I like it very much. Will start to code some Bots right away....
Thanks and best regards
Wolfgang
03-08-2018 08:32 AM
Thanks for reporting this issue, the engineering team has indicated they will be committing a fix shortly.
08-23-2018 08:03 AM
08-23-2018 08:21 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide