Retrieving a component’s definition
To configure and run a component for your end users, you need to understand the component’s definition. Now that you have the component’s key from the previous step, you can retrieve its structure from the Pipedream API. See the component structure section in our docs for more details. As an example, the following API call will return the structure of the List Commits action for GitLab:Configuring action props
Component execution on behalf of your end users requires a few preliminary steps, focused on getting the right input parameters (aka props) to the component. Configuring each prop for a component often involves an API call to retrieve the possible values, unless the values that a prop can take are static or free-form. The endpoint is accessible at:options method that retrieves the necessary options from the third-party API, formats them, and sends them back in the response for the end user to select. Examples are listing Slack channels, Google Sheets, etc.
The payload for the configuration API call must contain the following fields:
external_user_id: the ID of your user on your endid: the component’s unique ID (aka key)prop_name: the name of the prop you want to configureconfigured_props: an object containing the props that have already been configured. The initial configuration call must contain the ID of the account (akaauthProvisionId) that your user has connected to the target app (see this section for more details on how to create these accounts).
projectId prop of that component:
Fields inside
configuredProps are written in camel case since they refer to the names of props as they appear in the component’s code, they are not attributes that the API itself consumes.- Add the prop you currently want to configure as the
prop_name - Include the names and values of all previously-configured props in the
configured_propsobject. Keep this object in your app’s local state, add a prop once you or the end user selects a value, and pass it to theconfigured_propsAPI param.
refName prop:
Configuring dynamic props
The set of props that a component can accept might not be static, and may change depending on the values of prior props. Props that behave this way are called dynamic props, and they need to be configured in a different way. Props that are dynamic will have areloadProps attribute set to true in the component’s definition.
After configuring a dynamic prop, the set of subsequent props must be recomputed (or reloaded), which is possible using the following API call:
prop_name field since the goal of this call is to reload and retrieve the new set of props, not to configure a specific one.
Using the Add Single Row action for Google Sheets as an example, the request payload would look like this:
sheetId prop is dynamic, and so after configuring it, the set of props must be reloaded. The response will contain the new set of props and their definition, similar to when the component information was first retrieved. The response will also contain an ID that can be used to reference the new set of props in subsequent configuration calls. If this is ID is not provided, the set of props will be based on the definition of the component that was retrieved initially.
To illustrate, the response for the request above would look like this:
Invoking an action
At the end of the configuration process for an action, you’ll end up with a payload that you can use to invoke the action. The payload is similar to the one used for configuring a prop, with the exception of theprop_name attribute (because we’re not configuring any props at this point):
exports: all the named exports produced by the action, like when calling$.exportin a Node.js component.os: a list of observations produced by the action (e.g. logs, errors, etc).ret: the return value of the action, if any.- When using File Stash to sync local files, the response will also include a
stashproperty with file information.
Error responses
When an action fails, the response includes anerror object with an attribution field that classifies where the error originated:
origin field indicates where the error occurred:
Error attribution is best-effort. Pipedream observes HTTP calls made during action execution and correlates them with the thrown error, but the classification may be incorrect in some cases, such as when the upstream provider’s SDK makes telemetry or logging calls after the actual failure, or when multiple calls are made to the same host.
Special Prop Types
SQL Prop
Thesql prop is a specialized prop type used for interacting with SQL databases. It enables developers to build applications that can:
- Execute custom SQL queries
- Introspect database schemas
- Support prepared statements
postgresql-execute-custom-querysnowflake-execute-sql-querymysql-execute-raw-querymicrosoft_sql_server-execute-raw-queryazure_sql-execute-raw-queryturso-execute-query
Configuration
When configuring these actions, you’ll need to provide:- Database app type and auth (e.g.,
postgresqlin this example) - A
sqlprop with the following structure:
Using prepared statements
You can use prepared statements by including placeholders in your query and providing the parameter values in theparams array. Different database systems use different placeholder syntax:
- PostgreSQL uses
$1,$2,$3, etc. for numbered parameters - Snowflake, MySQL, Azure SQL, Microsoft SQL Server, and Turso use
?for positional parameters
Using prepared statements helps prevent SQL injection attacks by separating the SQL command structure from the data values being used, and is strongly recommended.
Retrieving database schema information
By retrieving the database schema, developers can:- Provide database structure to AI agents for accurate SQL generation
- Build native SQL editors with autocomplete for tables and columns
- Validate queries against the actual database schema before execution
configureComponent on the sql prop to retrieve database schema information:
context.dbInfo object containing detailed schema information for all tables in the database: