Deployment

Overview

Once pipes are created, they can be run 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 integrate pipes into your code and workflow.

Running Pipes From Code

Running Pipes from Your Code using the REST API

The Flex.io 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.

To run a pipe from the shell:

To run a pipe in Javascript:

To run a pipe in Python:

Running Pipes from Your Code 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 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:

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:

For more information about installing the Javascript SDK with npm, see the Javascript SDK documention.

Running Pipes In Workflows

Scheduling a Pipe to Run in the Background

Pipes can be scheduled to run in the backround. To schedule a pipe:

  1. Sign in to Flex.io.
  2. Select Pipes from the menu to see a list of your pipes.
  3. Click on a pipe in the pipe list to open the pipe you’d like to schedule.
  4. Open the schedule dialog by clicking on “Options…” next to the “Scheduled” item in the pipe properties.
  5. Set the schedule for when you would like the pipe to run and click “Save Changes”.
  6. Activate the schedule by turning on the button next to the “Scheduled” item and clicking the pipe “Save” button.

Triggering a Pipe from an Email

You can run a pipe by emailing the pipe at `{username}|{alias}@pipes.flex.iowhereusernameis your username andaliasis the alias of the pipe. For example, if your username istest-userand your pipe alias isprocess-email`, you can run the pipe by sending an email to “test-user|process-email@pipes.flex.io“.

To give a pipe an alias, do the following:

  1. Sign in to Flex.io.
  2. Select Pipes from the menu to see a list of your pipes.
  3. Click on a pipe in the pipe list to open the pipe you’d like to give an alias.
  4. In the pipe properties, assign the pipe an alias by entering a valid alias in the “API Endpoint” text box and pressing the “Save” button.

Triggering a Pipe from a Webhook

To run a pipe from a webhook, add an HTTP GET or POST request to the webhook using the pipe run 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:

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.

Monitoring Pipes

When pipes are run calling the pipe run API endpoint, the API request blocks until the pipe process is finished, and the results are returned in the response. If the process succeeds, the HTTP response code is set to 200; if the process fails, the HTTP response code is set to indicate an error and response body contains information about the error.

When pipes are run by scheduling, they can be monitored by checking the associated process logs for the pipe.