✋ Hi, is there a way to save a contact? or associate it with an app that saves contacts? (📜 The idea would be to use an example message, you put them to say "name and age" and with that message you save the contact)
✅ Thanks for reading and if anyone knows of any tutorial or wants to explain it to me, I would greatly appreciate it, sorry for the inconvenience and my English!🤙
#Save a contact
51 messages · Page 1 of 1 (latest)
not possible
I did it with google contacts (Google people API)
Here is a sample of how i did it
I save them with their id in my case that are unique
Hello, I could do it before... Before I got involved with programming, I paid for a service, from some people who I don't know how their configuration was going, but they associated their bot with peoplesync, a very old app but it worked... and if it could be replicated that would be great, because with a message auto saved to contacts
thanks i will check it out!!!
yes it also works for me, but is it functional? 😮 thank you very much
ah nice
I didn't know it got renamed to google people
I was going to make a guide about it once
"Coding
After you get all the initialization ready, let's start coding!
so, install the googleapis package: yarn install googleapis or npm install googleapis
and import it in code:........."
for it to work you have to put something in the .env file, right? That's what I can't do :/
This is people documentation page :
https://developers.google.com/people
You need to create a google cloud platform account :
https://cloud.google.com/
Get your subscription done for free, then you'll get a token in a json file that create a link between the api and your google contact account.
Make a folder where you put a file that is named token.json in it.
In your .env file, GOOGLE_TOKEN_PATH is the path to your folder with token.json file ($path/token.json)
In your .env file, GOOGLE_CREDENTIALS_PATH is the paths to the credentials.json file that is created by the code ($path/credentials.json)
Thank you very much, this helps me a lot, it is difficult for me to understand everything, but I am adapting, two questions, 1 the "token.json" file, I put all the token.json that Google generated for me? and ($path/credentials.json) I create that and what content do I put inside? thank you and sorry for the inconvenience and ignorance
Sorry, it is the opposite (token.json creates itself, credentials.json you put your credentials given by google)
it looks like this
Did I replace this or did I do something wrong? xd
"redirect_uris":["http://localhost"]
and I don't see the "access_type" and "prompt"
error :/ :
Error 400: redirect_uri_mismatch
very good.
I discontinued that guide since I though the API was actually closed, its name was Google Contacts API and so after the documentation disappeared I never got around to doing it
thanks
I guess instead of using OAuth you can use the token stuff from the google cloud dashboard
if you have multiple clients then it is not going to be easy
You can use a regular database for that or even JSON
I already solved that, I had to create one with "web" and change the "web" to "installed", now I have another conflict, in my app.js I put: js {new Contact("hello", "+33642589456", "blablabla@gmail.com")}
Simulating what happened to me, but I took everything out and just left it with "" and it throws me this error:
GaxiosError: Must specify a non-metadata contact field on the person. I used the example code you passed from "contact.js" @red glacier I managed to connect but I can't add new contacts, please help!!
but if I put the code as you put it, that is: js {new Contact("hello", "+33642589456", "blablabla@gmail.com")} returns me: GOOGLE CONTACT => Contact created, status code: 200 (means that I save well the contact? how long does it take to update on my phone?)
And according to what I see, it adds "that contact" with the given name between example: "hello" with the number between "", example "+65498476345984" and with the given mail too, example "sdfwsf@gmail.com", like Can I make it take the number that sends that message and schedule it with a name X or with a message that I choose?
I'm not sure I understand everything of what you're saying.
However if you have Contact created status code 200, you should see your new contact on your Google contact account, it doesn't take time to update, it's instantly. Try to console.log the res at the end (instead of res.status) to see what happens.
For the reste you do whatever you want, I did this like this because it was easier for me to have name:Id, emailaddress:email, phonenumber:phone but you don't have to do same.
You juste need a phonenumber and a name and the name you choose with your code what it is
@red glacier Yes, thank you very much, everything worked, except that I can't extract YOUR phone number, that is, when you send me a message, can I get your phone number? as I would do it? (sorry for my English )
message.author
or await message.getContact()
how do i get the refresh token? it tells me that the token expires :/
tx
you get the refresh
use it to refresh the access token
how do i get the refresh?
?
For real i don't remember bro, i've done this 7-8 months ago and I remember that i took maybe one month to make something working.
Since this i have not touch this once and it still works.
But i remember that refresh token was not given by Google and maybe there was something with "bearer token". I think i've changed credentials that google gave me so it can be refreshed but i'm not sure so far ...
But yeah, this google api stuff is incomprehensible ^^ Their documentation isn't clear
if that's why I asked for help, because everything worked fine for me, I scheduled and everything, until he asked me for that update and I don't know what to do:/ it never worked again. Thank you very much anyway for answering me, if you find any solution, please tell me, have a good day!
I'll check and if i got something i'll tell you. Have a nice day too !
Try to have the same json i have but replace black lines by your stuff
I have it as it is, and it worked fine for me, but this throws me:
0|bot | 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
0|bot | 'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
0|bot | connection: 'close',
0|bot | 'content encoding': 'gzip',
0|bot | 'content-type': 'application/json; charset=utf-8',
0|bot | date: 'Monday, November 14, 2022 19:42:02 GMT',
0|bot | expires: 'Monday, Jan 01, 1990 00:00:00 GMT',
0|bot | pragma: 'no cache',
0|bot | server: 'scaffolding on HTTPServer2',
0|bot | 'encoding transfer': 'chunked',
0|bot | vary: 'Source, Source X, Reference',
0|bot | 'x-content-type-options': 'nosniff',
0|bot | 'x-frame-options': 'SAME ORIGIN',
0|bot | 'x-xss-protection': '0'
0|bot | },
0|bot | status: 400,
0|bot | statusText: 'Bad request',
0|bot | request: { response URL: 'https://oauth2.googleapis.com/token' }
0|bot | },```