yakyak
yakyak copied to clipboard
Contact Names + Photos missing for SMS messages
When I get SMS messages in my Hangouts, the name and photo of the contact don't show up (they do in the regular Hangouts app). It's not a broken image link, just the regular hangout icon,

Any thoughts? Thanks!
Yeah, the name just shows as the phone number. Is this an API restriction?
I guess messages in this case have a different payload.. never looked as i don't have friends sending sms to me on google hangout
Might be a Google Voice-specific feature now that that service can be integrated in Hangouts. To test, would suggest setting up a free Google Voice account and sending a few SMS to that number from your own phone. I'll probably give fixing it a try later this evening too.
I use Google Voice. Definitely a problem with SMS sent to the GV number.
I can verify this as an issue. I’ll look into the regular Hangouts web app to see what XHR requests it’s making. I’m using a Google Voice number, which for a long time the Hangouts app had the same trouble with. I ended up re-inputting many people into Contacts to get it to work.
Same here, though I'm using Project Fi with a ported Google Voice number. Though I'm pretty sure the backend behavior of Fi and regular GV are the exact same, just commenting for completeness's sake.
BUMP... would love to see this fix implemented, and know many others who say the same!
+1
Also, messages sent to/from the GV number don't display the "SMS" tag over the contact picture.
Confirmed to still be an issue in 1.3.3. This is a weakness over Google's official client.
Is this a restriction of hangupsjs? Should an issue be logged there as well?
We need someone that uses hangouts with sms to debug and find why
it could be a problem with the library, or maybe the name and photo have a different structure with this type of contact
if someone wants to pick this up I can help showing in which data structures to look
@averissimo Sure, if you want to tell me what to look for (what exact commands to run, what data to look for, etc) I'll try to help.
@AndrewJDR this should require having a development version of yakyak and some skills to pursue stuff if this first approach does not do it :)
First go to src/ui/views/convlist.coffee and add the line in bold below line 38, using the same indentation as the line above.
console.log 'Drawing ' + p.id + '\'s avatar', entity[p.id]
This is how it should look (with a lot more space in the begging

Second compile and run yakyak (npm start) and you'll see a lot of new lines in the console, look for the one that should be drawing your contact. Expand the object on the right (except the _proto properties) and screenshot it here, such as:

@averissimo I sent you an email privately with the screenshots.
I would say the news is not good -- the display name is not contained in any of the members that I can see.
Furthermore, I wanted to mention an observation I made: When loading the contact list in google hangouts using gmail, I noticed that the contact name doesn't show up immediately. First, it shows the phone number for a fraction of a second, THEN fills in the contact name.
This told me that it's probably performing a separate lookup to obtain the contact name. Realizing this, I tried the following:
- I found an SMS contact in my google hangouts list that did not already have a corresponding entry in my google contacts (By "google contacts", I mean https://contacts.google.com) and therefore only showed up as a phone number in my gmail hangouts list. Let's say this contact had the phone number +1-888-888-8888.
- Using https://contacts.google.com, I added a new contact "John Doe" with the phone number "+1-888-888-8888"
- I reloaded my gmail. As expected, now now showed "John Doe" instead of 888-888-8888 for that same contact. Also as expected, upon reloading gmail, there was a slight delay before the 888-888-8888 was changed to "John Doe" in the contact list. Again, this indicates that it's doing some kind of separate lookup against the google contacts list to fill in this name.
Based on all of this, I believe a separate call (or a set of separate calls) to the google contacts api will be necessary to retrieve the phone number -> Full Name mappings.
Google contact api info is here: https://developers.google.com/google-apps/contacts/v3/ I'm in a timecrunch right now with another project, so code-wise, I won't be embarking on fixing this myself, but I can continue to provide data/information, so let me know if I can help you in that department.
Btw, something like this could potentially be used to avoid having to implement most of the google contacts api client code - https://github.com/olalonde/Google-Contacts
Also, it'd be nice if this went in as part of hangupsjs, so that other things using hangupsjs could benefit by a proper SMS contact names.
Using the google contacts api could be a nice alternative, if the same token could be used for both hangupsjs and gcontacts. Otherwise it could be a pain in the ass :)
Can you check 2 more things?
- test if tdryer/hangups can recognize the contact's name (hangups was based on this library -- and it is more heavily developed that ours)
- install and run the client to see how that contact appears
- you can run with your yakyak token:
hangups --token ~/.config/yakyak/refreshtoken.txtor equivalent directory in you OS
- there is also some information on the participant in the conversation (see diff and screenshot below)
- although I guess the fallback name would be the number again
+++ src/ui/models/viewstate.coffee
@@ -81,6 +81,7 @@ module.exports = exp = {
@setLastKeyDown 0
updated 'viewstate'
updated 'switchConv'
+ console.log 'Selected new conversation', conv[conv_id]

This is what tdryer/hangups shows at my test account, if number appears here then we'll probably have to implement a call to contacts api

@averissimo
-
Regarding hangups, unfortunately, I tried with the latest git of hangups and it shows only the number for that contact. I used this release - https://github.com/tdryer/hangups/tree/7ec7a73c7f85159807424b53ddbbeea4524900ba I'll email you a couple of screenshots just for your reference.
-
At first I got excited when I saw a name here, but I then realized that this data structure shows both participants, and one of them is me. So I had a bit of false hope there. Ultimately, the participant_data doesn't seem to contain any name information about the contact. The fallback is still just the phone number. I've emailed you a screenshot of that.
And yeah, i was wondering the same thing about the authentication token -- I'm not sure whether or not it can be shared between the contacts api and hangouts.
Your initial assesment was correct, it was a hopeful approach though ;)
Our current token does not ask for this, I tried the library you referenced with current token
If we introduce the contacts API users would have to logout and login again to get a new token that adds that authorization
To avoid forcing all users having to do this, I'd guess a non-obstrusive message each time an SMS account is detected could be presented hinting the user to logout->login
But that would be something that who wants to pick this up have to decide.
btw on my test of that library, I could not find any mapping from chat_id and contact_id :\
@averissimo Hmm, I guess that doesn't really surprise me so I'm not disappointed.
I'm not saying this won't be a pain to implement overall, but the mapping between google contacts and the hangouts data doesn't seem to me to be the tricky part of it? I always assumed it would need to map using the google contact phone number <-> fallback_name or google contact phone number <-> phone_number.el64, or similar. And perhaps everything should be stripped of all non-number characters before mapping to work around any little differences there?
But maybe I'm missing something there and it's more complicated than I expect, correct me if I'm wrong!
@averissimo this is a feature I really want, i'd be willing to create a service class or something that handles the mapping. It seems like Hangouts is the best SMS for Google Fi and YakYak seems like the best OSX app for hangouts.
I know coffeescript relatively well and I have Google Fi, I just need some direction on how to develop it.
@hadees If you look at the google people api: https://github.com/google/google-api-nodejs-client/blob/master/apis/people/v1.js it should be possible to pull the contacts using that, then cross-reference these contact's phone number's against the fallback_name on the hangouts side.
This guide looks to give a decent start on using the people api: https://developers.google.com/people/quickstart/js And this project has the client api in js: https://github.com/google/google-api-nodejs-client This is the call to get all the user's contacts: https://developers.google.com/people/api/rest/v1/people.connections/list
I think the slightly tricky business about all this is that the existing hangouts oauth token is no good for doing queries against the people api -- it doesn't have the proper scopes in place. When you try to add those scopes here, then use the people api with the existing hangupsjs refresh token, you will probably get an error ("You must add People API access to this project, please log into the project on some google url and add it", or similar). Problem is, That project is the one used by the official hangouts app on iOS, so you don't have access to change it (by "that project", i mean the "
To overcome this limitation, I believe you may have to create a completely separate project on google, add google people api access to that, then when the user logs into yakyak, obtain and separately save an oauth refresh token against that project so you can make queries from the user's contact list.
If you look at this, that'd be great! I would like to but I simply don't have the time right now. Hopefully my notes here makes sense and are helpful. If you have any questions let me know and I'll try to help.
@AndrewJDR first of all, very informative comment _o_
Second, both scopes can live under same oauth token, right? if so I believe we can just invalidate existing one and force user to re-login once this goes live.
@hadees once you are able to get the mapping via (some API) I can definitely help you integrate with YakYak
on getting the right api, well.. I guess that will require some try and fail approach :) with people api or other.
@averissimo -
Second, both scopes can live under same oauth token, right?
Unfortunately, I don't think so. Even if you add the google people scope to the existing oauth request on this line, the moment you try to make a call on the people api, you'll get an error like "You must add People API access to this project, please log into the project on < some google url > and add it", or similar. I tried, and that's what happened to me.
Basically, it seems that you need both the scope in the oauth request AND you have to add the google people api permission on the google side using the project website. And again, we don't have access to this project's website, since the project is "Hangouts for iOS" or whatever -- https://github.com/tdryer/hangups/blob/master/hangups/auth.py#L4
So I might be wrong, but I think two separate oauth tokens would be necessary, unless an alternate google api can be found instead of the people api (e.g. the google contacts api?) that doesn't have this problem of needing to add an additional permission to the application on the google side.
what about just using the local contacts? If they are already syncing with google.
In lieu of a proper integration with the Google people API, I'd settle with being able to "nickname" a conversation. I could see that feature being appreciated even if a proper integration is added later.
Just wanted to chime in, I'm a Mac user, and would love this feature to become available.
My knowledge of web/app development is limited, but I'm available to test/debug if it would help.
Thanks for your awesome work, love the app.
Sorry new to this, My understanding is that Google voice is intergreated now for SMS, but the contact information is still missing is that correct?