Create timeline event using the Hubspot api

SOLVE
New Member

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.

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

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.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes
4 Replies 4
Community Manager

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.

Reply
0 Upvotes
Highlighted
Regular Contributor

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

Not applicable

any update on above question. facing same issue.

Reply
0 Upvotes
HubSpot Moderator

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.

Isaac Takushi

HubSpot Developer Support
Reply
0 Upvotes