How to access project app-connections from a piece at runtime

:wave: Hi

I’m working on a custom piece (trigger/action) and I’d like it to automatically use a connection at execution time, without showing any connection dropdown to the user in the flow builder.

Our setup:

  • We upsert the connection via API (one per project, tied to the piece).
  • At runtime, we want the piece to fetch and use that connection based on the project context.

I came across this topic on the forum, which seems related.
However, I’m not sure how to apply the suggested approach to our case — we don’t have a previous step returning the connection, and we’re not using the builder UI to let users pick one.

Is there a clean way for a piece to retrieve the project’s connection directly at runtime?

Thanks in advance for any help! :pray:


(I saw something about the ConnectionsManager from community framework, but not sure about it)

Hi

You can use the combination of connection pieces where you can read the connection using it’s external id.

In the piece you can click on (f) on the connection field and specify the output of connections piece step

Just to confirm, from our custom piece, through the context, we call the connections.get(..) with an external name ?

this external name should be the same value for every project, and will be provided on app connections upsert

EDIT:
I tried to use context.connections, but it doesn’t exist :x:
I’m using a self-hosted in community version (I wonder if its a feature only available for enterprise version)

Hi there context.connections won’t get printed in the logs if that’s what you are basing your analysis on, though connections,get(connectionExternalId) does work.