How can I access secrets in a python custom code element? The example given is in js…
Hey, @anewhubspotuser
Thanks for reaching out. Can you link us to the specific page and example you are referring to, please?
I found some resources to help get us started:
- Refresh OAuth 2.0 access token
- How to get HubSpot API key and Access Token
- This post from a community member (thanks @taran42
) covering a similar request — Update secrets value using custom code
Thank you for the additional information! — Jaycee
I am referring to Workflows | Custom Code Actions - HubSpot docs . There is only a js example for handling secrets.
HubSpot has it in their documentation under the Get Started section in the Python code example, but when I used their code it didn’t work. I tried the below code and you can access a secret using it.
Replace SECRET_KEY in the code with your own.
import os
from hubspot import HubSpot
def main(event):
api = os.environ.get('SECRET_KEY')