Create timeline event using the Hubspot api


#1

Hi everyone

I have been asked to send events to some contacts timeline automatically using a scheduled script.

It seems the oauth2 needs the user to use his browser to authenticate (and get the code)

Given I would need to authenticate within the script,
does it exist another way ? For example using the api key ?

The documentation does not mention it.


#2

Hi @Jim

Oauth requires a HubSpot user to log in and click the grant access button, after which you’d get a code that can be used to get the access token and refresh token. If you provide the refresh token to your script, it would be able to get access_tokens to access the APIs going forward.


#3

Does this refresh_token expire? Can I store it and use for all further calls to the api?


#4

any update on above question. facing same issue.


#6

Hi @Sebastian_Lozada and @yogen,

The refresh_token does not expire, so you can store it and use it to obtain a new access_token every 6 hours, per this documentation.


#7