APIs & Integrations

Jim3
Member

Create timeline event using the Hubspot api

SOLVE

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.

0 Upvotes
1 Accepted solution
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Create timeline event using the Hubspot api

SOLVE

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

Associate Certification Manager

View solution in original post

0 Upvotes
4 Replies 4
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Create timeline event using the Hubspot api

SOLVE

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

Associate Certification Manager
0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Create timeline event using the Hubspot api

SOLVE

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.

0 Upvotes
Sebastian_Lozad
Member

Create timeline event using the Hubspot api

SOLVE

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

Not applicable

Create timeline event using the Hubspot api

SOLVE

any update on above question. facing same issue.

0 Upvotes