# Custom Code - Get firstname & lastname from email address

**URL:** <https://community.hubspot.com/t/custom-code-get-firstname-lastname-from-email-address/88815>\
**Category:** Data Hub\
**Created:** [September 1, 2023, 3:15pm UTC](https://community.hubspot.com/t/custom-code-get-firstname-lastname-from-email-address/88815 "2023-09-01T15:15:56Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Maciek-Magic](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Maciek-Magic](https://community.hubspot.com/u/Maciek-Magic)\
**Post date:** [October 5, 2023, 7:42am UTC](https://community.hubspot.com/t/custom-code-get-firstname-lastname-from-email-address/88815/9 "2023-10-05T07:42:39Z")

</div>

Looks like you didn’t change SECRET\_NAME to your Secret name with Private App token.  
I’ll walk you through.  
Navigate to **HubSpot Settings**

In Left menu find **INTEGRATIONS \> PRIVATE APPS**

Click **Crate a Private app** button  
In **Basic Info** give it a name - ex. **Contact**

In **Scopes** in **CRM** find _crm.objects.contacts_ and select **Read** and **Write** for it

Click **Create App** button and **Continue creating** in pop-up

Click **Show token** and **Copy**

Now go to you Custom Code step in workflow  
Second from Top there is a Dropdown list with Secrets, click it

Click Add Secret,

Give it a **name** best would be same as you gave to you **Private App** ie. **Contact** so you know what is what  
In **Secret Value** paste token you copied from Private App. And Save it.  
Now go to your code and change this

`accessToken: process.env.SECRET_NAME`

to this

`accessToken: process.env.Contact`

---

_[View the full topic](https://community.hubspot.com/t/custom-code-get-firstname-lastname-from-email-address/88815)._
