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

Migrate to People API #177

Merged
merged 3 commits into from
Sep 12, 2021
Merged

Migrate to People API #177

merged 3 commits into from
Sep 12, 2021

Conversation

plainerman
Copy link
Collaborator

The old Google Contacts API has been deprecated.
This PR implements the migration to the new people API.

This PR fixes #176

@GioBonvi
Copy link
Owner

Thank you @plainerman! I quickly tested this and it looks like it might work without changing any configuration (e.g. adding APIs via the cloud console).
Can anyone else confirm if it is like this for everyone or did I already add the People API a while ago while developing some features and forgot about it?

If that's the case then there is no need for any change in the documentation.

@plainerman
Copy link
Collaborator Author

Would be great if someone could just try to copy paste the code and run it and check if there are changes needed.
When checking, you should force a mail.

For me, the easiest way to do this, was to change the anticipatedDays to include a day where a contact has a birthday (e.g. change to [0,1,2,3,4,5,6,7] if you have a contact that has a birthday in the coming week).

anticipateDays: [0, 1, 7],

@GioBonvi
Copy link
Owner

You can use the test() function as well, which forces the main function to use an arbitrary date as today (which must be set in the in settings.debug.testDate).

@WmOne
Copy link

WmOne commented Jul 13, 2021

for those like me that are not much pratice, can you please also write the instruction for replace the old code with this, and let it work ?

@GioBonvi
Copy link
Owner

@WmOne We are currently checking, but if everything goes well it should not be different than any of the updates which were released in the previous years: copying and pasting the code should take care of everything.

Anyways, when the official release will be rolled out I'll make sure that update instructions are included as always.

@3ter
Copy link

3ter commented Aug 3, 2021

Hey @plainerman, I've just copied https://raw.githubusercontent.com/GioBonvi/GoogleContactsEventsNotifier/22eb90a5ed344a8ecda142cf601c8f804a6057c7/code.gs and got the following Syntax error: Syntax error. line: 377 file: Code.
And after this there is Syntax error: Syntax error. line: 433 file: Code.

I'm pretty sure I'm doing something not the way you intended it...

Also, the only method for people.connections I can find in Google's API reference is list and you're using find in line 377.
EDIT: You're using list a few lines above that, I get that part at least now (the capitalization is important in .connections vs .Connections).

I'm a bit confused.

EDIT: Resolved, see the explanation in #176 (comment)

@3ter
Copy link

3ter commented Aug 3, 2021

It worked flawlessly for me, looking good 👍

8:04:48 PM	Info	I: Date used: Sat Aug 07 2021 06:00:00 GMT+0200 (Central European Summer Time)
8:04:49 PM	Info	I: Looking for contacts events on Sat Aug 07 2021 00:00:00 GMT+0200 (Central European Summer Time) (2021-08-07T00:00:00+02:00 / 2021-08-07T00:01:00+02:00)
8:04:49 PM	Info	I: Found: 1
8:04:49 PM	Info	I: Looking for contacts events on Sun Aug 08 2021 00:00:00 GMT+0200 (Central European Summer Time) (2021-08-08T00:00:00+02:00 / 2021-08-08T00:01:00+02:00)
8:04:49 PM	Info	I: Found: 0
8:04:50 PM	Info	I: Looking for contacts events on Sat Aug 14 2021 00:00:00 GMT+0200 (Central European Summer Time) (2021-08-14T00:00:00+02:00 / 2021-08-14T00:01:00+02:00)
8:04:50 PM	Info	I: Found: 0
8:04:50 PM	Info	I: Found 1 events.

@plainerman
Copy link
Collaborator Author

Great, awesome!

Then I will change the code to work without V8 so that no change is needed :)

Copy link
Collaborator Author

@plainerman plainerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing changes

code.gs Outdated Show resolved Hide resolved
code.gs Outdated Show resolved Hide resolved
code.gs Outdated Show resolved Hide resolved
@plainerman plainerman marked this pull request as ready for review August 26, 2021 18:07
@plainerman
Copy link
Collaborator Author

@GioBonvi it seems that this branch is good to go. Is there anything to do before merging it?

@plainerman plainerman merged commit 897e1ad into master Sep 12, 2021
@plainerman plainerman deleted the add-people-api branch September 12, 2021 10:45
@WmOne
Copy link

WmOne commented Dec 14, 2021

can we please have same kind of instruction on what we have to do to implement this changes ?

@plainerman
Copy link
Collaborator Author

@WmOne It is the usual update procedure that can be found here.

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

Successfully merging this pull request may close these issues.

Deprecation of the Google Contacts API (June 15, 2021)
4 participants