The Connector Builder tool is a fast, smart, and secure way to add new connectors (actions and triggers) for any web application’s API. So, if there is a service with an API that is not available on Built.io Flow yet, you can use the connector builder to create a reusable connector that can be shared and published across the platform.
In this blog post, we will look at the steps involved in adding a new connector to Built.io Flow.
Let’s say that you want to use Google Drive and it isn’t on Built.io Flow yet. You can use the Connector Builder to create both triggers and actions for Google Drive.
Before you get started with the Connector Builder, make sure you have:
- Node version upto 6.10.X
- REST API for the service
Detailed requirements are available here.
Quick Steps to add a new connector
Open Node.js terminal and enter the commands below:
Step 1. Install the Connector Builder globally
npm install @builtioflow/connector-builder -g
Step 2. Login to Built.io Flow
Your Connector Builder is installed and ready to go!
Step 3. Create a new connector with the required files
You will be prompted to provide a name for the connector. For example: ‘Google_Drive’
Note: The connector name should consist of only alphanumeric characters and underscores.
Step 4. Go to the newly created directory
For example: cd Google_Drive
Step 5. Install all the libraries needed for your Connector Builder app
You should now have a working local connector. You can now start adding the code for your actions, triggers, lookups, and authentication.
Step 6. Add actions, triggers, and lookups
6.1 To add new action, use:
flow create action <action_name>
For example: flow create action move_folder
When you execute this command, a new ‘action’ folder will be created in your connector’s directory with a ‘<action_name>.js’ file in it. Add your action’s code in that file’s execute function and update the input and output schema based on your requirements. Learn more about creating action with the Connector Builder.
6.2 To add new lookup in your connector, use:
flow create lookup <lookup_name>
For example: flow create lookup file_id
When you execute this command, a new ‘lookup’ folder will be created in your connector’s directory with a ‘<lookup_name>.js’ file in it. You can then add your lookup code in that file. Learn more about creating lookup with the Connector Builder.
6.3 To add new trigger, use:
flow create trigger <trigger_name>
For example, flow create trigger new_mail
When you execute this command, a new ‘trigger’ folder will be created in your connector’s directory with a ‘<trigger_name>.js’ file in it. You can add your trigger code in that file. Learn more about creating triggers with the Connector Builder.
Note: The name should consist of only alphanumeric characters and underscores.
Step 7. Create authentication for actions/triggers/lookup
After entering this command, you will be prompted to select the authentication type (basic, API key, OAuth, custom). When you select an authentication type, an ‘authentication.js’ file will be created in your connector’s directory. You can then add authentication logic to this ‘authentication.js’ file. Learn more about creating authentication with the Connector Builder.
Step 8. Once all of your code is added, it’s time to test the connector
This is an optional step but we recommend that you perform it. The testing will be done against the sample data you have provided in your code.
Learn more about the error validations here.
Step 9. Deploy the connector to Built.io Flow
Once you have deployed the connector, refresh the browser window of Built.io Flow.
The deployed connector will be added in the ‘Actions’ panel under the ‘Custom’ tab or added to the list of triggers and will be available for you to use locally. You can then download, share/unshare, or publish this connector.
The reference code for creating ‘Google Drive - New Folder’ trigger and ‘Google Drive - Move Folder’ actions can be found here.
Read a detailed guide on the Connector Builder.