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 command deploy.

KeyTypeDescription
type"trigger"
service"http"Select the http service
eventKey"request"This event is emitted every time a request is made
endpointKeyStringA key used to generate a unique URL
authenticationBooleanOptional If 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
responseContentTypeStringOptional The content type of your response. The default is application/json.
responseReferencePathReference.keyOptional The value to return. By default the whole payload is returned but you can use the reference key system (examples here).

Example

liteflow.yml
workflows:
  my-workflow:
    steps:
      - type: trigger
        service: http
        eventKey: request
        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.
methodString(optional) HTTP request method to use. Default POST. https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods

Example

liteflow.yml
workflows:
  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.