You can use the embedded SDK to create connections.

1

Initialize the SDK

Follow the instructions in the Embed Builder.

2

Call Connect Method

After initializing the SDK, you will have access to a property called activepieces inside your window object. Call its connect method to open a new connection dialog as follows.

<script> 
activepieces.connect({pieceName:'@activepieces/piece-google-sheets'});
</script>

Connect Parameters:

Parameter NameRequiredTypeDescription
pieceNamestringThe name of the piece you want to create a connection for.
connectionNamestringThe name of the connection

Connect Result

The connect method returns a promise that resolves to the following:

{
    connection?: {
        id: string,
        name: string
    }
}

connection is undefined if the user closes the dialog and doesn’t create a connection.

Or if the connectionName parameter is defined, it could get rejected with an error message telling you why connectionName is invalid:

{
    error:string
}

If connectionName is defined, the connection name input will be disabled and if the connection name is invalid the returned result from the connect method will be an error message describing why it is invalid.

You can use the connections piece in the builder to retrieve the created connection using its name. Connections in Builder Connections in Builder