APIs & Integrations

siempeters
Participant

API authentication in AWS Lambda function in Custom Workflow Action (public app)

SOLVE

I am trying to build a custom workflow action for a public app. It will contain some some logic using an external AWS Lamdba function. Once the action is triggered the "ActionURL" will trigger the Lamdba function. In the Lambda function I want to assign an owner to a contact using the API. However, in the Lamdba function I do not have the API/Authentication available for the user. How can I handle? I like it to make a public app so I cannot store the API credentials in the secrets manager in API as it will be different for every user. 

Thanks in advance. 

0 Upvotes
1 Accepted solution
BrandonWoodruff
Solution
Participant

API authentication in AWS Lambda function in Custom Workflow Action (public app)

SOLVE

Hello,

 

The way that you would want to do it is by storing the Oauth creditials first through a different flow, and then have the Lambda function pull from the Oauth credentials. You would want to do it through the following flow:

  1. Verify the request came from HubSpot.

  2. Identify the portalId from the payload.

  3. Look up that portal’s stored refresh token.

  4. Exchange the refresh token for an access token (if needed).

  5. Call HubSpot APIs with that access token to assign an owner by updating hubspot_owner_id on the contact.

Here are some OAuth Docs from the old docs:
https://developers.hubspot.com/docs/apps/legacy-apps/authentication/working-with-oauth
There is also the new development platform that now sets apps as marketplace, or allows private apps to authenticate through Oauth. The docs are found here:
https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/oauth/working-... 

Let me know if this helps, or if you have any other questions!

 

 


✔️ Was I able to help answer your question? Help the community by marking it as a solution.

BrandonWoodruff_0-1757337851297.jpeg

 

 

Brandon Woodruff
Senior Software Developer @ Pearagon

Still have questions? Reach out at brandon@pearagon.com

BrandonWoodruff_1-1757337851226.png

 

 


 

 

View solution in original post

0 Upvotes
2 Replies 2
BrandonWoodruff
Solution
Participant

API authentication in AWS Lambda function in Custom Workflow Action (public app)

SOLVE

Hello,

 

The way that you would want to do it is by storing the Oauth creditials first through a different flow, and then have the Lambda function pull from the Oauth credentials. You would want to do it through the following flow:

  1. Verify the request came from HubSpot.

  2. Identify the portalId from the payload.

  3. Look up that portal’s stored refresh token.

  4. Exchange the refresh token for an access token (if needed).

  5. Call HubSpot APIs with that access token to assign an owner by updating hubspot_owner_id on the contact.

Here are some OAuth Docs from the old docs:
https://developers.hubspot.com/docs/apps/legacy-apps/authentication/working-with-oauth
There is also the new development platform that now sets apps as marketplace, or allows private apps to authenticate through Oauth. The docs are found here:
https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/oauth/working-... 

Let me know if this helps, or if you have any other questions!

 

 


✔️ Was I able to help answer your question? Help the community by marking it as a solution.

BrandonWoodruff_0-1757337851297.jpeg

 

 

Brandon Woodruff
Senior Software Developer @ Pearagon

Still have questions? Reach out at brandon@pearagon.com

BrandonWoodruff_1-1757337851226.png

 

 


 

 

0 Upvotes
Victor_Becerra
Community Manager
Community Manager

API authentication in AWS Lambda function in Custom Workflow Action (public app)

SOLVE

Hi @siempeters 
Thank you for reaching out to the Community!
I'd like to invite some community members who are subject matter experts to join this conversation.
@GiantFocal @BrandonWoodruff @karstenkoehler - Would you be able to share any insights on this? Your expertise would be greatly appreciated.
Best,
Victor


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

0 Upvotes