Is it Possible to Pre-select the Location ID in the HighLevel OAuth Connected App Instead of Using a Dropdown List?

This topic was automatically generated from Slack. You can find the original thread here.

in the HighLevel OAuth connected app the first configuration field is the location ID. You have to select the location from a dropdown list of connected accounts. Is there a way to have this selected in a previous step, rather than only having a dropdown to select the desired account.

To dynamically set the value of the location ID for the HighLevel OAuth connected app in Pipedream, you can use an options method within a prop in your Pipedream component. This method can fetch the list of locations from the HighLevel API and present them as selectable options in the UI. If you want to set this value based on the output of a previous step, you can reference the step export that contains the desired location ID. Here’s an example of how you might define such a prop with an options method: export default defineComponent({ props: { highlevel: { type: "app", app: "highlevel", }, locationId: { type: "string", label: "Location ID", async options({ steps, $ }) { // Assuming you have a step that lists locations and their IDs // You can reference the step export here to fetch the list of locations const locations = steps.previous_step.locations; // Replace with actual reference return locations.map((location) => ({ label: location.name, // Replace with actual property that has the location name value: location.id, // Replace with actual property that has the location ID })); }, }, }, async run({ steps, $ }) { // You can now use this.locationId in your API calls or other logic }, }) In this example, steps.previous_step.locations should be replaced with the actual reference to the step export from a previous step that contains the list of locations and their IDs. The label and value properties within the map function should also be adjusted to match the properties of your locations data structure. Please note that the options method can also make an API call to HighLevel to fetch the locations if needed, instead of relying on a previous step. If you need further assistance with this or have any other questions, feel free to reach out to Pipedream Support.

Code Error
options not supported for prop gohighlevel

It seems like you’re encountering an issue with the options method for the gohighlevel prop in your Pipedream component. The options method is used to dynamically generate options for a prop, typically from an API call, so that users can select from a list of options in the Pipedream UI. However, based on the documentation provided, there is no mention of an options method being used with the gohighlevel prop. The gohighlevel prop is defined as an app type, which allows you to connect your HighLevel account to the step and authorize requests to the HighLevel API. It does not support the options method directly. If you need to use an options method to allow users to select from a list of options related to HighLevel, you would typically define a separate prop for that purpose. Here’s an example of how you might define a prop with an options method: export default defineComponent({ props: { gohighlevel: { type: "app", app: "gohighlevel", }, myOptionsProp: { type: "string", label: "Select an Option", async options({ steps, $ }) { // Your code to generate options goes here // For example, making an API call to HighLevel to retrieve a list of options const response = await axios($, { url: `https://rest.gohighlevel.com/v1/some-endpoint`, headers: { Authorization: `Bearer ${this.gohighlevel.$auth.api_key}`, }, }); // Transform the response into the format expected by the options method return response.map(item => ({ label: item.name, value: item.id })); }, }, }, async run({ steps, $ }) { // Your code to run the component goes here }, }); In this example, myOptionsProp is a separate prop that uses the options method to generate a list of options from an API call to HighLevel. The gohighlevel prop is used to authenticate API requests. If you need further assistance or if you have additional details about the error you’re encountering, please let me know so I can provide more targeted help.