Integration Service
latest
false
Banner background image
Integration Service User Guide
Last updated Apr 24, 2024

Building your first connector

This section explains how to create a connector using Connector Builder and use it within an automation. The example covers creating a connector through a manual process, so we automatically cover and address points that can otherwise typically be skipped.

You can also see Building your connector from an API definition, where you import a Swagger definition and Connector Builder completes most of the work for you.

The workflow we are designing is meant to receive daily Slack messages of stock prices that are of interest. Polygon.io provides a set of free APIs that retrieve stock information and can be used for our purpose. They have a quick signup process that, in return, provides us with an API key to make the API calls that we need to make.

Sign up with Polygon.io

Most vendor applications require authentication details in the form of username and password, OAuth App, API key, etc. Polygon.io is no different. It provides a free sign up to try out some of their APIs.

  1. Go to polygon.io and create an account.
  2. Open your Dashboard and select API Keys to view your key.


Create a connector in Connector Builder

Within Automation CloudTM, navigate to Integration Service and select Build your connector.

Let's start with A blank connector. If you have any form of API definition at hand (Swagger, YAML, etc.), you can select Start from API definition and let Connector Builder do most of the configuration work for you.

Download the polygon.svg icon from the web to add their logo to your catalog.
Note: All image types are supported, but we recommend using a square SVG.

Add a name and description for your custom connector, then select Create.


docs image

Set up the authentication and connect

The Polygon Getting started documentation references that any API call to their platform requires you to send your API key in the headers or as a query parameter. To do this, you need to add it into the headers, as explained in the following example:

  1. Pass your API key in the query string as follows, where <your_token> is the API key:
    https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2023-01-09/2023-01-09?apiKey=<your_token>https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2023-01-09/2023-01-09?apiKey=<your_token>
  2. Alternatively, you can add an Authorization header to the request with your API Key as the token, in the following form, where <your_token> is the API key:
    Authorization: Bearer <your_token>Authorization: Bearer <your_token>
  3. In Connector Builder, navigate to Settings and select the Base API tab. Set the Base URL to https://api.polygon.io.
    Note: In this example, we do not add the version "v2" section to the Base URL, as this allows us to run some of the older stock API calls.

    docs image

  4. Next, go to the Authentication tab to select your preferred Authentication type from the drop-down list. For this example, let's select Personal Access Token (PAT).
    Note:

    The Polygon documentation refers to an API key, but given that it has to be sent as Authorization: Bearer <your_token>, it is actually closer to an OAuth style token. Therefore, Personal Access Token (PAT) is technically the better definition. Read more about the different Authentication types.

  5. Copy your API key from Polygon and set the Value as: Bearer <your_key>.
  6. Set the Ask the user field to No, so that users are not asked for their key when creating a connection to this connector. This is because we are not going to share this connector beyond our tenant. If, however, you want to share the connector beyond the tenant, don’t add your own key, but set Ask the user to Yes, so that other users are prompted to subscribe to the Polygon service themselves.

    The preconfigured authentication types in Connector Builder take care of most of the work for you. For example, Personal Access Token automatically sends Authorization: Bearer <your_token> as an auth header, rather than you having to build this config yourself.


    docs image

  7. Set up a connection with the above configuration by selecting the Not connected > Add connection button. Notice how this already works as any other Integration Service connector. Select Connect so that we have a test connection to make API calls to.

Test your API calls

After estabilishing a connection to the third-party software, we move on to performing the actual API calls.

  1. Navigate to the left-side panel to API > Create new resource group. The goal is to get a daily Slack notification on the opening price of a given stock. The endpoint we are going to implement now is Polygon's Daily open/close API.

    docs image

  2. In the Create new resource group window, copy the endpoint information from the Polygon docs.
  3. Set the Path to /open-close/{stocksTicker}/{date}.
  4. From the Select methods list, enable Get record (GETBYID), since we select a single object, rather than an array of objects.
  5. Provide a display name, such as Open - Close for stock. Connector Builder will automatically convert the {x} variables to path variables.
  6. Select Create to add this resource.

    docs image


    docs image

  7. To test if the setup is working, select the Send request button next to your resource. This creates values for the two path parameters. We can take them from the usage example in the Polygon docs.

    docs image

Publishing the connector to the catalog

You can take a few extra steps to make resources and parameters look and behave better. For example, identify that the Date parameter is of type DateTime and provide the mask as example. Providing Display names makes your connector show up better within the Studio activity. You can see an example in the following screenshot

docs image

As the final step, select Publish to publish your connector to your tenant. The connector appears in the list of connectors featured on your tenant, and anyone that is using the same tenant can see and use the Polygon connector.

docs image

Use the connector in UiPath Studio

Having a connector appear in Integration Service is only relevant if you can actually use it in a workflow.

To test your custom connector in a workflow:

  1. Open UiPath Studio and create a new project. For example, Slack daily stock prices. Since we want to receive daily messages, the first activity used in this workflow is a Time Trigger.

    docs image

  2. Next, when you drag a Polygon activity to the canvas, you are prompted to connect to Polygon.io with your account.
  3. Once a connection is established, configure the Polygon activity to retrieve information on Apple stocks (AAPL). You can hardcode the stock you are interested in, but you must format the date to be the runtime date.
  4. Next, add a Slack Send Message to Channel activity to send this info to a channel. If you want to send the information to yourself, use Send Message to User.
Note: Polygon’s API only takes in one stock at a time but you can configure Studio to do multiple calls through the connector and also notify on UiPath’s daily stock opening price (PATH).
Your flow should look as follows:
docs image

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.