when using integromat I am using Google Contact ID to make sure that I always work with the correct contact. Now I would like to save all Google Contact IDs. Ideally without using integromat. But I do not know how.
Asked
Active
Viewed 226 times
1
-
1Although I'm not sure whether I could correctly understand about `I would like to save all Google Contact IDs. Ideally without using integromat.`, using [People API](https://developers.google.com/people) is the direction you expect? – Tanaike Sep 06 '20 at 22:06
-
1If I can "read" Google Contact ID using People API than it would be a way how to accomplish what I want. I looked into it but could not find how I can get the ID.The closest I got is this https://developers.google.com/apps-script/reference/contacts/contacts-app#getContactById(String) – Radek Sep 07 '20 at 07:27
-
1Thank you for replying. From your replying, when you will use `ContactsApp` of Google Apps Script, for example, the script of `var ids = ContactsApp.getContacts().map(e => e.getId())` is the direction you expect? Of course, People API can also retrieve such ID. – Tanaike Sep 07 '20 at 07:35
-
1If `.getId()` exists then it must be exactly what I want. I have no experience with Google Apps Script but I will learn. Could you point me to some nice tutorial? Thank you. Do you want to create answer out of you comment? – Radek Sep 07 '20 at 07:45
-
Thank you for replying. By including more information, I posted it as an answer. Could you please confirm it? If you have any questions, feel free to tell me. – Tanaike Sep 07 '20 at 07:55
1 Answers
2
I believe your goal as follows.
- You want to retrieve the contact IDs like
http://www.google.com/m8/feeds/contacts/kanshi000001%40gmail.com/base/###
using Google Apps Script.
In this case, as a simple method, I think that you can use Contacts Service of Google Apps Script. The sample script is as follows.
Sample script:
When you use this script, please copy and paste the following script to the script editor and run myFunction
. By this, the authorization screen is opened. So please authorize the scopes. (This authorization is only one time while the new scopes are not detected.) By this, the script works and you can see the contact IDs at the log.
function myFunction() {
const ids = ContactsApp.getContacts().map(e => e.getId());
console.log(ids)
}
Note:
- Of course, you can also use People API with Advanced Google services. But when you can use Contacts Service, I think that above script is simpler.
References:

Tanaike
- 181,128
- 11
- 97
- 165
-
thank you Tanaike. I do not exactly how to code this but now I know where to start and I am sure I will get there. The function you wrote will log IDs of all contacts? – Radek Sep 07 '20 at 08:00
-
@Radek Thank you for replying. In this case, the contact IDs which are registered at the Contact can be retrieved. But I'm not sure whether this is the all contacts for your actual situation. I apologize for this. – Tanaike Sep 07 '20 at 08:03