+ Start a Discussion
Alex Nussey 3Alex Nussey 3 

Can I create a configuration panel for a lightning component?

Hello everyone!

I am working on creating a lightning component that will pull data from an external API. Essentially, I want the component to exist on the Contact Record page and read off the email address if there is one. From there, it should reach out to the 3rd party API, request info about that email address, and display it inside the component. I have all of this figured out except for one thing. Right now, I have to have the API key for the 3rd party API hard coded into the component's code. I'd like to have it so that whoever adds component to the layout can enter their API key once, and have it stored and used with the component. Ideally, the user would be promped for thier key when they first install the component, but I would settle for persistant settings anywhere within Salesforce. Is something like this possible?

Vivek DVivek D
You can store the API in custom labels and can fetch the API key in init method when component loads. 
// In controller or helper

// Inside the component markup

Alex Nussey 3Alex Nussey 3
In that scenario, how would the end user input their API key in the first place? I would like each org using this component to be able to configure their own API key. And my (admittedly limited) understanding of labels is that they will not persist if set programmatically