App connection Image
Articles Blog Development Featured Article Featured Post Development Sales Workato

How to change App Connections at Runtime in Workato Recipes

This blog post by Incepta technical team explains the step-by-step method to change the app connections at runtime.

While creating a Workato recipe, developers need to think about actions, triggers, and connections to various applications to perform specific tasks. You establish connections, add some actions and then start the recipe which will perform a job after being triggered by the specific trigger condition.

What if you need to change the connection to an application (let’s say Gmail) with different credentials (user 2 instead of user 1)? Can we do this change at runtime?

The answer is, YES. By using the Runtime User Connections feature of Workato, users can authenticate to an application with their own credentials at runtime without stopping the recipe.

There are two ways to do this in Workato

  1. In Recipe functions
  2. In Workbot command recipes

In this article, we will talk about how to implement Runtime User Connections in Recipe functions.

How to implement Runtime User Connections

Let’s implement a simple use case. Suppose, at my company, there is a separate mailbox for HubSpot deal management. Whenever I or any of my team members update the stage of a deal to Closed Won, we need to send an email to that mailbox so that the manager can immediately get the notification.

We want Workato recipes to capture the change in HubSpot and also send an email to the mailbox. But, when I am updating Hubspot deals, the sender’s email should be my email address. When any of my team members is in charge of the HubSpot deal update, his/her email address should be the sender’s email.

Let’s see how we can implement this in Workato by following a simple 2-step procedure.

Step 1: Create a Recipe function

#1) First, create a recipe function with proper parameters, that will be passed to this recipe from another recipe.

app connections - recipe function

#2) Select the ‘Send email’ action in the ‘Gmail’ app and authenticate to Gmail. This will create a default user connection for Gmail.

app connections - recipe function

#3) Set up the Recipient’s email address, Subject, Message body, and other fields accordingly.

app connections - recipe function

For our demonstration, we have set the recipient email address as an environment property. The message body of the email is simple plaintext with no attachments.

#4) Save the recipe and exit the tab.

#5) Go to the ‘Settings’ tab. Under the ‘Runtime user connections’ section, switch the toggle next to the connection that you want to be changed at runtime.

 recipe function

In our case, this ‘Recipe Function’ recipe has only one app connection which is Gmail. If multiple connections are present in the recipe, all the application names will appear under the ‘Runtime user connections’ section and we can enable this feature for one or multiple applications. If this is disabled, the default user connection that was created while creating the recipe will be used for further execution.

#6) Start the recipe.

Step 2: Create a recipe to call the Recipe Function 

#1) Create another recipe that will be triggered on New/Updated Deal in HubSpot, establish the connection with a Hubspot account, and set the trigger condition to check only for a Closed Won deal.

main recipe

#2) In the Next step, select the ‘Recipe functions by Workato’ app using ‘Action in an app’.

#3) Select either the Synchronous or Asynchronous option of calling a recipe function under the Action tab. Synchronous call of a recipe function makes the calling recipe wait for the recipe function to finish. When you want the calling recipe to continue with the next step without waiting for the recipe function to complete, select the Asynchronous call option.

main recipe

#4) Select the recipe function that we created earlier and all the parameters that need to be passed. The name of the recipe function that we created in the first step is the Recipe function.

app connections

#5) Under the ‘Connection Overrides’ section, select the Connection Name/ID which we want to be used inside the recipe function.

app connections

NOTE: This user connection, which is different than the default one, should be established before.

#6) Save and Start the recipe.

#7) Change the stage of a deal to Closed Won in HubSpot. You will see an email has been sent to the mailbox from your user account.

app connection - deal close

In this article, we assumed that the user has proper privileges to view and edit the Runtime User Connections. To know more about managing the Runtime User Connections, you can visit this Workato Documentation.


In this blog post, we have explained how to change the app connections in Recipe Function at runtime along with screenshots of each step. Such technical know-how would help you become a better automation expert whether you are a seasoned Workato developer, architect, or a newbie. Contact our technology experts to learn more or to engineer a unique solution to automate your business processes.