Integration Service
latest
false
Banner background image
Integration Service User Guide
Last updated 25 de mar. de 2024

Building your first connector

This page guides you to manually create a connector using Connector Builder and use it within an automation. We are covering the creation through a manual process so we automatically cover and address points that can otherwise typically be skipped. For example, we will be importing a Swagger definition, where Connector Builder will complete most of the work for you.

The workflow we are building 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 and provides a free sign up to try out some of their APIs. Click their Signup button to obtain an API key.
docs image

Create a connector in Connector Builder

Within Automation Cloud, navigate to Integration Service and click the first tile in the catalog, which is called Build a new connector, and start with A blank connector. 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.
If you have any form of API definition at hand (Swagger, YAML, etc.) , you can start with the first tile and let Connector Builder do most of the configuration work for you.
docs image

Set up 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, we need to add it into the headers, like in the following example:

Pass your API key in the query string as follows:
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>
where <your_token> is the API key.
Alternatively, you can add an Authorization header to the request with your API Key as the token in the following form:
Authorization: Bearer <your_token>Authorization: Bearer <your_token>
where <your_token> is the API key.
In Connector Builder, navigate to Settings > Base API where you must complete the Base URL and set it 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
Under Settings > Authentication set the Authentication type drop-down to Personal Access Token (PAT). 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 and therefore PAT is technically the better definition. Read more about authentication types within the documentation.
In the screenshot we put our key as the value and set it so users won’t be asked for their key since 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 keep Ask the user: yes so that they 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. As an example, the Personal Access Token that we currently configured automatically sends Authorization: Bearer <your_token> as an auth header, rather than you having to build this config yourself.
docs image

Set up a connection with the above configuration by clicking Not connected > Add connection at the top-right corner of the screen. Notice how this already works as any other Integration Service connector. Click 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. 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

On the modal from Create new resource group copy what you see on screen from the Polygon docs.

Set the path to /open-close/{stocksTicker}/{date} and select Get record (GETBYID) under methods, since we select a single object, rather than an array of objects. Provide a display name such as Open - Close for stock. Connector Builder will automatically convert the {x} variables to path variables.
docs image
To test if the setup performed is working, click Send request at the top. 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. Identify that the Date parameter is of type DateTime and provide the mask as example. Providing Display names will make your connector show up better within the Studio activity. You can see an example in the screenshot below:
docs image
As the final step, hit 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 Studio

Having a connector appear in Integration Service is only relevant if you can actually use it. Navigate to the Studio designer of your preference and create a new project. For this example, we will be using Studio Web and will name the project Slack daily stock prices, also making this a daily event. Since we want to receive daily messages, the first activity used in this workflow is a Time Trigger.


docs image

When you drag a Polygon activity to the canvas, you are prompted to connect to Polygon.io with your account.

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. Next, add a Slack activity to send this info to a channel or yourself .

Polygon’s API only takes in 1 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 like in the following image:
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.