In this article we will cover how to create your first integration flow to synchronize the data between two applications or services.
We assume that this is your first experience with the elastic.io platform, so we explain every step in detail. Please follow these steps to create your first integration flow.
When you login first time you will have a similar view of the elastic.io platform.
To start click on +Add new flow button to load the integration flow designer.
The designer helps building the flows from the reusable integration components
actions. Every integration flow starts with a
component to retrieve data from the source. To start let us find the
Petstore component in the list of integration components.
For that purpose type
petstore in the search bar and you will find it. Next,
click on Choose Petstore API (Node.js) button.
Next, you will see the page Choose Credentials where you need to click on +connect new credentials link to create your first credentials. Let us fill-in an input form for these two fields:
secretto get access to our Petstore API.
Click on Save to verify the credentials. The verification can take no more than 30 seconds. Upon completion you will see the page to choose one of the 3 triggers available in the Petstore component.
Typically a component can have more than one triggers to retrieve different objects from the source API. Here we use the Petstore component to learn the elastic.io platform. It provides 3 different triggers to retrieve pets by their status. These 3 triggers differ by the implemented code style. So select any of them, for example click on the Get Pets By Status With Promises radio button to continue.
The Get Pets By Status With Promises trigger returns
Sold values for the
Pet Status parameter. Click on drop-down menu to open it.
Available option and click on Continue button.
Now we retrieve a sample from Petstore API where the pet status is
When the process is successful you will see the following page to choose retrieved sample.
Click to Choose this sample and continue. Next you will see the Retrieve sample page again.
Please click on Continue button here to go further.
Note: Please don’t click on Retrieve sample from Petstore API (Node.js) button again. You will get back to the earlier stage to select the sample again. This is not a problem, but unnecessary at this stage.
The screenshot shows the summary page for this step. Here you can rename the step and add some descriptive notes. Click on + Add another step button to continue.
We have the data source, now we need to choose the data target. After completing
the trigger configuration you need to choose an
action component to send the
data from the Petstore API to. Let us choose the E-Mail component.
We can find it in the list of components. The E-Mail component has no credentials, so we jump directly to the mapping of data between Petstore and E-Mail components.
The screenshot above demonstrates the mapping of data between the Petstore trigger and E-Mail action. The E-Mail components requires a configuration of 3 following fields to work properly:
To field: expects an e-mail address wrapped by colons, such as
"email@example.com". E-Mail component will use this field to send the data to. Note that if you enter the address without wrapping them by
" " it will get rejected.
Subject field: expects email’s subject as a
string expression. Here we use some advance JSONata expression:
$count(pets.id) & " " & "new pets found"
Please note that we will not dive into JSONata at the moment, copy and paste this expression into the Subject field.
Body field: expects email’s body as a
string. Here is another JSONata expression to copy and paste:
"Darling, I found some adorable pets for us. Here are their names: " & $join(pets.name, ", ") &". Which one shall I buy?"
Click Continue after filling-in the form to continue.
On the next page click on Retrieve sample from E-Mail to retrieve the sample.
When the sample gets retrieved click on Choose this sample to continue.
We have finished configuring this demonstration flow. You could add more steps after this moment but we recommend you not to at this stage. Click on I’m done button once.
You can name your integration flow or accept the suggested name by clicking on I’m done one more time to finish and save the current state of your Draft.
Note: at this stage you can still modify this draft flow.
Before the flow can be used we need to publish the current draft. After you publish this flow you cannot change this version of the flow, unless you create a new draft of this flow. Click on Publish Draft button to finish modifying it and saving this version of the flow.
Success, your integration flow is ready!
Now you can start you flow by clicking Start Flow button.
Your flow is now active, congratulations! Go to Dashboard to see the results of your first integration flow execution.
Here we are in the Dashboard view. In the Runlog part you can see the first execution. You can come back to this view from everywhere by clicking the Dashboard icon in the left-side menu. Let us check the details of the execution by clicking on the name of the flow in the runlog.
Here we are in the execution view. Click on the component icons to view the logs for each step in your first integration flow. When you have examined the logs, you can return to the Dashboard. After a couple of minutes we can visit the Dashboard again.
Here we have the Dashboard view after your flow gets executed 3 times. You can view the details of each execution by clicking on the name of your flow in the runlog.
Your flow is now active and working! Go ahead, make another one. Try using different integration components to build your flow.