michael-adler / sync-google-contacts

Automatically exported from code.google.com/p/sync-google-contacts
18 stars 12 forks source link

Migrate to People API in light of impending Contacts API deprecation on June 15,2021 #15

Open RandallKent opened 3 years ago

RandallKent commented 3 years ago

Google announced the deprecation of the Contact API effective June 15, 2021. They recommend moving to the People API which provides feature parity with the exception of working with "Other Contacts". A Migration Guide is also provided.

Relevant Docs/Notes:

Pull Contacts

mrmattwilkins commented 3 years ago

Hi Randall. Any progress on this?

RandallKent commented 3 years ago

No, I've not written any code.

mrmattwilkins commented 3 years ago

Damn. I totally rely on this code, I worked on it a number of years ago putting in the adding-new-user thing, and it took ages to figure it all out. Not looking forward to the people API migration, and was hoping someone else might have started on it!

mrmattwilkins commented 3 years ago

Hi, The changes were substantial, so I just did it from scratch. https://github.com/mrmattwilkins/google-contacts-sync Welcome to use it if you want Cheers Matt

fleapower commented 3 years ago

Is Michael Adler's code no longer working? It seems like it has stopped sync'ing over the last few days (it had been working flawlessly since October).

fleapower commented 3 years ago

Trying to do some troubleshooting...I am getting an error which looks like a local error, "The system cannot find the path specified." Don't know how Google would be causing it on their end. Any suggestions before I go deeper on this? Thanks!

RandallKent commented 3 years ago

@fleapower - Google announced the deprecation of the Contact API effective June 15, 2021. Michael's code was written on the Contact API so it is no longer working since the API has been deprecated.

fleapower commented 3 years ago

@fleapower - Google announced the deprecation of the Contact API effective June 15, 2021. Michael's code was written on the Contact API so it is no longer working since the API has been deprecated.

Thanks. Any alternatives you know of? I see @mrmattwilkins has written a new contact sync based on the People API, but it apparently doesn't sync groups which I really need.

mrmattwilkins commented 3 years ago

Sorry about that (lack of groups). I just didn't need it, and got the syncing to the point of usefulness for me. You might want to check out the repo though, the syncing was surprisingly easy, there isn't a lot of code to it, so adding groups might not be too difficult. Cheers Matt

On Mon, Jul 12, 2021 at 9:23 AM fleapower @.***> wrote:

@fleapower https://github.com/fleapower - Google announced the deprecation of the Contact API effective June 15, 2021 https://developers.google.com/contacts/v3/announcement. Michael's code was written on the Contact API so it is no longer working since the API has been deprecated.

Thanks. Any alternatives you know of? I see @mrmattwilkins https://github.com/mrmattwilkins has written a new contact sync based on the People API, but it apparently doesn't sync groups which I really need.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/michael-adler/sync-google-contacts/issues/15#issuecomment-877863670, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVF756DPYGZTQGBH4A5FJLTXIDW3ANCNFSM42H6HXDA .

fleapower commented 3 years ago

Thanks. I'm a complete Python noob, but I'll take a look. I'll let you know if I figure it out.

On Sun, Jul 11, 2021, 17:32 mrmattwilkins @.***> wrote:

Sorry about that (lack of groups). I just didn't need it, and got the syncing to the point of usefulness for me. You might want to check out the repo though, the syncing was surprisingly easy, there isn't a lot of code to it, so adding groups might not be too difficult. Cheers Matt

On Mon, Jul 12, 2021 at 9:23 AM fleapower @.***> wrote:

@fleapower https://github.com/fleapower - Google announced the deprecation of the Contact API effective June 15, 2021 https://developers.google.com/contacts/v3/announcement. Michael's code was written on the Contact API so it is no longer working since the API has been deprecated.

Thanks. Any alternatives you know of? I see @mrmattwilkins https://github.com/mrmattwilkins has written a new contact sync based on the People API, but it apparently doesn't sync groups which I really need.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub < https://github.com/michael-adler/sync-google-contacts/issues/15#issuecomment-877863670 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACVF756DPYGZTQGBH4A5FJLTXIDW3ANCNFSM42H6HXDA

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/michael-adler/sync-google-contacts/issues/15#issuecomment-877864578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEAMOKCU7LOCWI2VJE4ROHLTXIEYBANCNFSM42H6HXDA .

watsapptv commented 3 years ago

I'm going off-topic for a moment. This new people API is have me a way.. need some help with my little code

my setup is that i have a google form that link to google sheet and every new contact that get added my code below would run in google app script and add or update my google contact. it was work over a few years now but a couple days ago it stop work. can you rewrite this with the new people api. thanks inadvance

App script code below

function fromSubmitted(e){ const info = e.namedValues; const contactArray = ContactsApp.getContactsByPhone(info["WhatsApp Number"]); if(contactArray.length === 0){ addContact(info); } else { updateContact(contactArray[0],info); } }

function addContact(info) { const c = People.People.createContact(info["User Name"], info["Last Name"], info[""]); c.addPhone(ContactsApp.Field.MOBILE_PHONE, info["WhatsApp Number"]); c.setMiddleName(info["Birth Year"]); c.setSuffix(info["Parish"]); c.setPrefix(info["Gender"]); c.addCompany(info[""],info[""]); c.setNotes(info["Phone Network"]); const cg = ContactsApp.getContactGroups(); c.addToGroup(cg[4]);

}

function updateContact(c,info) { c.setGivenName(info["First Name"]); c.setMiddleName(info["Birth Year"]); c.setSuffix(info["Parish"]); c.setPrefix(info["Gender"]); c.setNotes(info["Phone Network"]); c.addCompany(info[""],info[""]); c.setFamilyName(info["Last Name"]);

}

fleapower commented 2 years ago

Matt, been awhile. Well, I really needed group sync, so I wrote a Google script from scratch to do contacts sync which includes group sync. It resembles more of Frankenstein's monster than pretty code. It is a work in progress, but it is functional. I've been using it for a couple of weeks with four accounts. You (or anyone) are welcome to try it if you'd like.

https://github.com/fleapower/Google-Script-Contacts-Sync