query-stringcontactsgoogle-contacts-api

Pre fill google contact add form from url query field


I want to add a feature in admin panel, in which when admin click on phone number, it will redirect to google contact add url and I will pass customer data in query URL. This query data will automatically pre-fill in google contact form.

Using this URL

https://contacts.google.com/new?email=test@example.com&phone=0000000000

I can pre-fill Email and phone number. But i also want to pre-fill First Name, Surname, Labels, Country Code, DOB.

I tried with various query parameters like firstName,firstname, first_name etc. But none of them worked other than this email and phone.


Solution

  • I landed on this after trying a few things.

    https://contacts.google.com/new?email=jack@example.com&familyname=Smith&givenname=Jack

    I got the idea to try "givenname" from this gist:

    https://gist.github.com/samkit5495/ff8e2a6644363cadaec3fa22ddf38c90