hangouts-bot
hangouts-bot copied to clipboard
send message
I couldn't figure out sending messages. I tried the following
var hangoutsBot = require("hangouts-bot"); var bot = new hangoutsBot("xxxxx", "xxxx");
bot.on('online', function() { console.log('online'); bot.sendMessage("[email protected]","testing from nodejs");
});
bot.on('message', function(from, message) { console.log(from + ">> " + message); });
Can you receive messages in the console if you send a message to the bot while its connected?
On Tue, Jan 20, 2015, 10:06 AM amrsobhy [email protected] wrote:
I couldn't figure out sending messages. I tried the following
var hangoutsBot = require("hangouts-bot"); var bot = new hangoutsBot("xxxxx", "xxxx");
bot.on('online', function() { console.log('online'); bot.sendMessage("[email protected]","testing from nodejs");
});
bot.on('message', function(from, message) { console.log(from + ">> " + message); });
— Reply to this email directly or view it on GitHub https://github.com/jaxbot/hangouts-bot/issues/1.
Yes. and also if someone else sends me while the bot is connected, it's well received.
Is the username you're sending to friends with the bot, I.e. if you log in as the bot can you message that address?
Yup. I checked this too, I am friends with the person I am trying to send.
That's strange. It works on my machine™, so I'll have to debug this when I get home from work
Just played with it some more. Works for me when I put in my gmail address in the [email protected] format. Not really sure what to think. Any errors coming up?
Can you put a console.log statement in node_modules/hangouts-bot/index.js
in here:
this.sendMessage = function(to, message) {
var stanza = new xmpp.Element('message',
{
to: to,
type: 'chat'
})
.c('body')
.t(message);
this.connection.send(stanza);
}
to verify it is getting to that piece?
Any news about it?
Hi, same happening to me...any progress on this??
Hi, sendMessage does'nt work for me with my email. But i've log in message callback the from variable :
i've got somethink like
[email protected]/xxxxxxxxxx
If i use this "email" sendMessage work fine 👍