This topic was automatically generated from Slack. You can find the original thread here.
When building a custom component how can i leverage the apps ability to search and list items. Example using airtable_oauth app how can i leverage the Select Base from dropdown in my component props?
To use functions from the native Airtable component in your custom component, you can define a custom Pipedream component that uses the Airtable app. This allows you to leverage the existing functionality, such as dynamically selecting a base and table. Here’s how you can create a custom component that uses the Airtable OAuth app and allows users to select their base and table dynamically: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { airtable_oauth: { type: "app", app: "airtable_oauth", }, baseId: { type: "string", label: "Base", description: "Select the Airtable Base", async options({ prevContext }) { const params = {}; if (prevContext?.newOffset) { params.offset = prevContext.newOffset; } const { bases, offset, } = await this.listBases({ params, }); const options = (bases ?? []).map((base) => ({ label: base.name || base.id, value: base.id, })); return { options, context: { newOffset: offset, }, }; }, }, tableId: { type: "string", label: "Table", description: "Select the Airtable Table", async options({ baseId }) { const tables = await this.listTables(baseId); return tables.map((table) => ({ label: table.name, value: table.id, })); }, }, }, async run({ steps, $ }) { // Your custom logic here }, }); ### Explanation: 1. Airtable OAuth App: The airtable_oauth prop allows the user to connect their Airtable account, authorizing requests to the Airtable API. 2. Dynamic Base Selection: The baseId prop uses an async options method to dynamically fetch and display the list of bases from the user’s Airtable account. It uses the listBases method to retrieve the bases. 3. Dynamic Table Selection: The tableId prop uses an async options method to dynamically fetch and display the list of tables from the selected base. It uses the listTables method to retrieve the tables. 4. Custom Logic: You can add your custom logic within the run method to perform actions based on the selected base and table. This setup allows you to dynamically select bases and tables in your custom component, leveraging the existing Airtable functionality.
if i build a custom component (my actions) that needs the user to authenticate with airtable and submit a base id and table they cant have the option to select from a list rather than having to go fetch the id and doing a custom entry?