Showing results for 
Search instead for 
Did you mean: 

Jabber Bot SDK - make direct_mention detection case-insesitive

Level 4
Level 4


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: '',

        password: 'super-secret',

        host: "im&",

        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

3 Replies 3

Cisco Employee
Cisco Employee

Thanks for reporting this issue, the engineering team has indicated they will be committing a fix shortly.

There's another issue we are experiencing where the TO field is appending a unique identifier and the findBotJid function isn't matching.

botclientID is testbot@nerdherd.local

the TO field in the message for a direct mention in a chat is coming in as:
to: 'testbot@nerdherd.local/0d2a112473b111ad1f3c7213c3532d5d7f5932ee',

Any thoughts on this?


fixed it. it was the regular expression .. it was only looking for 3 letter domain TLDs like .com .. we are using a 5 letter one in the lab and had to adjust the expressions in the following places.

in the function
function extractMentionJids(message) {
let direct_mention_reg = /href="xmpp:\s?(\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+)\s?"/ig; <- had to adjust it from 2,3 to 2,5

let email_reg = /\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,5})+/i; <- same here had to adjust it to 2,5

and now it works. just in case anyone runs into this in the future - especially with the advent of longer TLDs