HTTP

The HTTP Service lets you create an HTTP endpoint with a unique URL that triggers the associated workflow when an HTTP request is received.

You can also use this service to call any endpoints from within your workflows. They can be HTTP endpoints created with Liteflow but also any external endpoints (webhooks).

Events

Request

Definition

The parameter endpointKey helps to generate a unique URL. Keep the same value when you update your workflow to keep the same URL. Change its value to generate a new unique URL.

The URL will be generated by the commands dev and deploy.

KeyTypeDescription
type"trigger"
endpointKeyStringA key used to generate a unique URL
authenticationBooleanIf set to true, the endpoint requires your users' requests to contain an authorization header with the bearer access token of the user. (eg: Authorization: Bearer accessToken. See the Authentication docs for more info

Example

workflow.yml
name: my-feature
steps:
  - type: trigger
    endpointKey: endpointX
    authentication: true
  # ...

Data

The HTTP endpoint trigger contains the following data:

KeyTypeDescription
bodyObjectAll the data contained in the request body
headersObjectAll the headers contained in the request
userIdStringOptional If endpoint requires authentication, then this data will contain the userId of the authenticated user.

Tasks

send

Definition

KeyTypeDescription
type"task"
service"http"Select the HTTP service
taskKey"send"Task needed to send an HTTP Request.
inputssendInputsInputs required to send an HTTP Request
Send inputs

These inputs are pre-defined Inputs. All types of Inputs are accepted including References.

KeyTypeDescription
urlStringURL that you want to call.
dataObject(optional) Data you wish to send.
headersObject(optional) Additional headers that you want to send.

Example

workflow.yml
name: my-workflow
steps:
  ...
  - type: task
    service: http
    taskKey: send
    inputs:
      url: https://mywebsite.com/my-webhook-endpoint
      data:
        foo: bar
      headers:
        authorization: 'Bearer xxxxx'
  - ...

Outputs

The result of the task returns the following information about the data.

keyTypeDescription
statusNumberStatus code returned by the request.
statusTextStringStatus text returned by the request.
dataAnyData returned in the response.
headersStringHeaders sent in the response.