Deployment

Overview

Once pipes are created and turned on, they can be deployed by configuring the Pipe Builder.

Pipes: Adding Tasks

Activating a Pipe

A pipe can have a test status or an active status. In a testing or prototyping status, the pipe is “OFF” and can be run manually using the “TEST” button at the top of the Pipe Builder.

When a pipe is active, it is considered “ON” and can be deployed. This section discusses pipe deployment options.

Pipes: Adding Tasks

To turn a pipe from test to active, use the “ON/OFF” toggle button at the top of the Pipe Builder, in the Deployment section of the Pipe Builder or from the Pipe List. Once a pipe is ON, your deployment choices will be activated.

Deploying a Pipe

Pipes can be deployed as an API endpoint from your code, scheduled to run in the background, or run an email or webhook trigger. In the following sections, you’ll learn ways to deploy pipes from prototyping to production.

Specifically, you’ll learn how to do the following:

In addition, once deployed you can monitor your pipes using the activity report.

Running Pipes on a Schedule

Pipes can be scheduled to run in the backround using the Flex.io scheduler. You can turn on the scheduler by checking the “Run on a schedule” checkbox from the Deployment section of a pipe.

Deployment: Scheduling Option

By default, the scheduler is set to run once per day. However, you may configure the scheduler by clicking the Edit hyperlink.

Deployment: Scheduling

In the scheduler configuration, you may choose a schedule that fits your needs:

After checking the scheduler and setting your time, be sure to activate your Pipe in order to commence running the Pipe on schedule. The pipe will not be scheduled if the pipe is OFF (i.e., in testing mode)

Running Pipes from an API endpoint

Pipes can also be run as an API endpoint. In order to access an API endpoint for your pipe, you must check the appropriate box from the Deployment section of a pipe.

Deployment: API Endpoint

Once you’ve deployed as an API endpoint, you’ll be given the following snippets:

The sections below will discuss using your API endpoint as a webhook or using it with the Flex.io REST API or with the Flex.io Javascript SDK.

Triggering Pipes with a Webhook

To run a pipe from a webhook, add an HTTP GET or POST request to the webhook using the pipe API endpoint.

If you’re using an HTTP GET request in your webhook, configure the endpoint as follows, where {id} is the eid or alias for your pipe and {token} is your API key:

For example, if your pipe alias is hello-world and your key is usnrlunfdpaywerpsdpr your GET request would be:

GET 'https://api.flex.io/v1/me/pipes/hello-world/run?flexio_api_key=usnrlunfdpaywerpsdpr'

If you’re using an HTTP POST request in your webhook, configure the endpoint as follows, where {id} is the eid or alias for your pipe and {token} is your API key and set in the POST header Authorization: Bearer {token}:

Parameters or information sent in the webhook is passed to the pipe when it runs, and the parameters can be used to take the appropriate action. See the section Passing parameters to a Pipe for further information.

Running Pipes using the REST API

The Flex.io REST API utilizes HTTP requests, so you can easily integrate pipes into your code by issuing the appropriate request. Here are some examples that show how to run a pipe using HTTP requests in several different contexts.

For each of these examples, configure the endpoint as follows, where {id} is the eid or alias for your pipe and {token} is your API key:

To run a pipe from the shell:

To run a pipe in Javascript:

To run a pipe in Python:

Running Pipes using the Javascript SDK

If you’re developing a web application or on the server-side with Node.js, you can use the Javascript SDK to run pipes in your code.

Running Pipes in Node.js

First install the Javascript SDK using the npm package manager at your command prompt:

Next, configure the Flexio object as follows, replacing {token} with your API key:

Once you’re set up, you can run a pipe as follows, replacing {id} with the eid or alias for your pipe:

Running Pipes in Client-side Javascript

First, include a link to the Flex.io Javascript SDK:

Next, configure the Flexio object as follows, replacing {token} with your API key:

Once you’re set up, you can run a pipe as follows, replacing {id} with the eid or alias for your pipe:

Triggering Pipes from an Email

Another way to deploy a pipe is to trigger it via an email. For example, a pipe could use some text or an attachment from the email as a parameter.

Deployment: Email Trigger

To send an email to your your pipe, use the following format, where {username} is your username and {id} is the eid or alias for your pipe:

{username}|{id}@pipes.flex.io

For example, if your username is test-user and your pipe alias is process-email, you can run the pipe by sending an email to:

test-user|process-email@pipes.flex.io

For further information on using parameters via an email, see the section Passing parameters to a Pipe.

Running Pipes On-demand with a Flex.io Web Interface

Pipes can also be run on-demand via a Flex.io custom web interface.

Deployment: API Endpoint

The Flex.io web interface option provides end-users with an on-demand “runtime” view of your pipe via URL, without exposing your carefully crafted wiring.

Deployment: API Endpoint

The most basic example of a web interface is a simple download page that returns the output of your pipe as a text file. However, in addition to downloads, the web interface provides you with flexibility to request authentication credentials from a user (i.e., logging in with their credentials and running your function against their account) and/or enabling users to apply parameters to your function (i.e., selecting a drop-down menu or entering a value or a date range).

Once your “Runtime” view is set up and your pipe is active, you can provide the URL to an end-user and they can run your pipe on-demand, as needed.

Passing Parameters to a Pipe

In addition to running self-contained pipes, you may also post parameters for a pipe to process.

This section will discuss the following:

Testing Pipe Parameters

While building and testing a pipe, it is often useful to protoype how params will work in context. See the documentation on the Pipe Builder Input section for further information on testing params along with an example.

Using Parameters with an API endpoint

When pipes are run from the REST API endpoint, parameters can be passed to the pipe either through QUERY parameters in the URL in a GET request or in the data payload of a POST request.

In the following GET request, the key/value pair in the query string is passed to the pipe, where {id} is the eid or alias for your pipe and {token} is your API key::

In the following POST request, the data payload is passed to the pipe:

Using Parameters from an Email

When pipes are triggered to run by an email, parameters can be passed to the pipe by header information, body text or attachments.

Here is an example Python script that uses the from address from the email as a parameter and sending a reply to that address:


Here is an example Python script that reads the subject and body text from an email:


Here is an example Python script that reads the attachments from an email:


Using Parameters with a Flex.io Web Interface

When pipes are triggered by an end-user on-demand via a Flex.io Web Interface, the user may also be required to provide query parameters, such as a value from a dropdown box. See the Flex.io Web Interface section above for more information.

Monitoring Pipe Activity

Flex.io records a history of pipe executions, whether manually run in testing or run in deployment. To see your activity history, navigate to the “Activity” tab at the top of the screen:

Deployment: Activity History

You may sort your list by using the controls next to the Activity List headers.