Getting Started
Combining your Gumloop flows with webhook triggers allows you to build APIs visually with no code!
Webhooks
All Gumloop flows can be triggered via your own external app using webhooks.
To see the code necessary to trigger your flow, navigate to your flow and click the ‘Webhooks’ button on the left side of the pipeline builder.
Inputs
Most useful flows require some input from the user. Inputs are defined using Input nodes and these inputs can be passed in using webhooks as well!
The following example takes in 3 separate inputs and sends an email. The inputs represent the recipient’s email, the email subject and the email body.
The ‘Input name’ values in each Input node represent the id of that input field. These input names are used to map the information you send via the webhook to the appropriate nodes.
Sending Inputs with POST Request
You can send inputs using a POST request by including them in the request body under the pipeline_inputs
field.
The pipeline_inputs
field should contain an array of objects, where each object has an input_name
that matches your Input node’s name and a value
containing the data you want to pass to that Input node.
The following is an example of how you would populate these 3 expected fields in an API call (cURL request).
Alternatively, you can also pass inputs by name directly in the body of the request. For example, the following is equivalent to the above POST request:
Sending Inputs with GET Request
Flows can also be triggered using a GET request. In this case, all body fields are passed in the URL query parameters. This can be useful if you want to trigger a flow from an external service that does not support POST requests.
Just like with the POST request, inputs are passed as an array of objects, where each object has an input_name
that matches your Input node’s name and a value
containing the data you want to pass to that Input node.
However, since we cannot provide a body with a GET request, inputs are passed with the pipeline_inputs
query parameter as a URL-encoded string.
In addition, for cases where headers cannot be provided, authorization can be provided with the api_key
query parameter instead of the Authorization
header.
The following is an example of how you would populate these fields in an API call (cURL request).
The value of pipeline_inputs
is a URL-encoded string equivalent to the following JSON body:
A one-line URL for triggering your flow can also be found by clicking the ‘Webhooks’ button on the left side of the pipeline builder and then clicking the ‘1-liner’ tab.
The main caveat to using this method is that because the inputs are passed in the URL, they are subject to URL length limitations. Maximum URL length limits vary by browser, but are typically around 2000 characters. If your inputs are longer than this, you will need to use the POST request method.
Sending Inputs in Headers
When using either method to trigger a flow, any provided headers will also be passed along as inputs to the flow. If you have an Input node with the same name as a header, it will be provided the header value as input.
The following is an example of how you could theoretically populate these fields in an API call, although it is recommended to use either of the other methods.
Outputs
When you run a Gumloop pipeline remotely, the POST request to https://api.gumloop.com/api/v1/start_pipeline
will return a run_id
and a URL that links to the flow run.
Here is an example of the response:
You can use run_id
to poll a separate endpoint to get information about the ongoing run like the status, logs, and outputs when it is completed.
In order to poll, make a GET
request to https://api.gumloop.com/api/v1/get_pl_run
with run_id
as a query parameter.
Here is an example of a GET request with cURL, Python, and JavaScript and their outputs:
Request with cURL
Request with Python
Request with JavaScript
Output
The key attributes here are log
, state
, and outputs
.
log
: Contains a running log of each node and the activities within it.
state
: One of “STARTED”, “RUNNING”, “TERMINATED”, “FAILED” or “DONE”.
outputs
: A JSON object with key-value pair where the key is the output name
and the value is the output value
. This will only be populated when your pipeline reaches a “DONE” state and you have named output nodes in your pipeline.