Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to find the chat_ids? #65

Open
Konstantinusz opened this issue Dec 10, 2016 · 1 comment
Open

Where to find the chat_ids? #65

Konstantinusz opened this issue Dec 10, 2016 · 1 comment

Comments

@Konstantinusz
Copy link

Are they the Google+ IDs?

My code is the following, its purpose is nothing but sending an image together with a text "hi", but unfortunately doesn't work:

#!/usr/bin/node
var Client = require('hangupsjs');
var Q = require('q');
var path=require('path');
var fp=path.resolve(process.argv[2])
console.log(fp)
// callback to get promise for creds using stdin. this in turn
// means the user must fire up their browser and get the
// requested token.
var creds = function() {
  return {
    auth: Client.authStdin
  };
};

var client = new Client();

// set more verbose logging
client.loglevel('info');

// receive chat message events
client.on('chat_message', function(ev) {
  return console.log(ev);
});

// connect and post a message.
// the id is a conversation id.
client.connect(creds).then(function() {
    client.uploadimage(fp, null, 30000).then(
       function(image_id){
		   console.log("image_id: "+image_id);
		   client.createconversation([109444762308105529580]).then(function(conversation_obj){
		      console.log("conversation_id: "+JSON.stringify(conversation_obj, null, 4));
		      client.sendchatmessage(conversation_obj.conversation.id.id,
             [[0, 'hi']],image_id).then(function(res){JSON.stringify(res, null, 4)},function(res){JSON.stringify(res, null, 4)},function(res){JSON.stringify(res, null, 4)}).done();
		    }
		   )
		   
		   
	    }
	);
}).done();

Image is uploaded, its ID is printed, but conversation with the person isn't created. I don't know why.

@Konstantinusz
Copy link
Author

Works now, I had to use
client.createconversation(["109444762308105529580"])

instead of

client.createconversation([109444762308105529580])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant