Update contact from API

I’m new to infusionsoft/keap ,what I’m trying to achieve is the following:
I have ans SMS flow in Twilio triggered by API, one of the steps of this flow is to add or remove a tag from a contact in Keap, what I’m finding difficult is the authentication part:
If I understand correctly every time I need to trigger this action I have to request permission to my app + request access token and in case it expires refresh it?
Or requesting permission is only one time action, and I would have only to refresh the token every time I would need a new one?
The other question mark I have is about where to store refresh_token? To do all this I would use the Twilio Functions (node.js) but I don’t really have a mean in Twilio to store this string for further reuse.
Is there a more straight forward way to do an API call (example add a tag) by just using the api key and api secret in the authentication?


Once you authenticate, you will receive a Refresh Token (expires in 6 months) and an Access Token (expires in 24 hours). If your Access Token expires, you can trade in the Refresh Token to get a new Refresh Token and Access Token, and repeat that process indefinitely. You should only have to re-authenticate if you allow the Refresh Token to lapse.

Yes, you will have to store the Refresh Token at least and update it every time you refresh. Currently we only support the OAuth2 Access Code flow, but we will be releasing additional options in the near future that may simplify the process for integrations such as this.


I have a vid that should help explain the process :wink:

@TomScott Thanks for the answer, looking forward to see the new options you will release, it will help, mainly for those who works in a Servrless environment!

@John_Borelli Thanks for the video, yes I watched it, but I didn’t want to believe this was really the only way to get access to the API :slight_smile:

Btw, thanks also to one of my colleague I was able to handle the app auth and access token creation within Twilio and storing the values in Twilio Sync, same approach could be used in other serverless environments I believe.