06-07-2018 07:25 AM
Hello,
I am trying to send an instant message to a Jabber chat room using a simple bot.
It works perfectly fine if I send the message to a single user but not when sending to a group.
bot.say(message = {
text: 'hi',
user: 'room@domain.name.com',
group: true,
}
Here is the code that fails to send the message. My bot is part of the chat room I am sending to.
Whats interesting is that the following piece of code works perfectly fine to regular users.
bot.say(message = {
text: 'hi',
user: 'name@domain.name.
}
Thanks in advance and best regards Jan
06-07-2018 06:56 PM
Use below code to send message to a pchat room.
bot.say(message = {
text: 'hi',
user: 'j4wteam77161840418404@conference-1-standalonecluster.alpha-cup.cisco.com',
group: true,
});
Make sure you have add this bot into the room. The room id is from room information of the pchat room. Remove im: when you copy room link to the code.
06-07-2018 11:00 PM
That's pretty much what I am doing but I don't see the message popping up.
Is there a way I can get some info about what is going wrong?
06-10-2018 06:16 PM
Can you send us a PRT and your test code for send the message to the chat room?
Thanks
06-11-2018 02:53 AM
here us my testcode although i have removed the domain and password ofc. It's just a simple script that should write the weekday when being triggered by crontab. Sorry but what is PRT?
const Botkit = require('.../JabberBot.js');
var controller = Botkit({
json_file_store: './bot_store/'
});
var bot = controller.spawn({
client: {
jid: 'user@domain.com',
password: 'Password',
host: "domain.com",
port: 5222
}
});
function sayMethod() {
var d = new Date();
var weekday = new Array(7);
weekday[0] = "##### SUNDAY #####";
weekday[1] = "##### MONDAY #####";
weekday[2] = "##### TUESDAY #####";
weekday[3] = "##### WEDNESDAY #####";
weekday[4] = "##### THURSDAY #####";
weekday[5] = "##### FRIDAY #####";
weekday[6] = "##### SATURDAY #####";
var day = weekday[d.getDay()];
bot.say(message = {
text: day,
user: 'room@domain.com',
group: true
}
);
return true;
}
setInterval((function () {
if (sayMethod()) {
console.log("Closing")
return process.exit();
}
}), 1000)
06-11-2018 07:29 PM
please remove this line and try again.
return process.exit();
06-12-2018 02:34 AM
Hi, I tried and it didn't work. That exact code minus "group: true," works for a regular user. There seems to be something wrong when it's sending the message to a room.
06-13-2018 07:58 AM
I have just created a new room for testing purposes and I get the same issue. when I press "edit settings" in Pidgin, my jabber client on that particular room I see the following fields.
Room: test
Server: domain.name.com
Handle: myUser
Password:
So I try the following:
bot.say(message={
text: 'text',
user: 'test@domain.name.com',
group: true
});
But nothing happens. I have tried executing the bot.say command in a try catch but there is nothing failing so I cannot get any further information.
06-13-2018 06:29 PM
You should click button "Copy room link" to get room id. You will get the following id.
im:test582121922919229@conference-1-standalonecluster.alpha-cup.cisco.com
And then when copy it to the user field, you should remove im:
And copy test582121922919229@conference-1-standalonecluster.alpha-cup.cisco.com.
And please make sure remove process.exit(); in your code.
06-14-2018 12:54 AM
I do not have the option to copy room link in pidgin. What client are you using?
06-14-2018 01:12 AM
Jabber 11.9.1
06-14-2018 01:46 AM
Trying to download the client and I keep getting the error bellow even though I have added my full address. Does it need to be validated on your side or how does it work?
ErrorCannot request association when the profile does not contain a complete and validated address. Please update the address in your profile using Cisco Account Profile. |
06-14-2018 02:10 AM
What server are you using?
06-14-2018 02:37 AM
Software Download - Cisco Systems
This one for downloading the client.
https://rpfa.cloudapps.cisco.com/rpfa/profile/profile_management.do
this one for updating my user account.
06-14-2018 02:46 AM
I mean the IM server you used. If your company use cisco Jabber, you need to deploy cisco IM&P server.
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