Workflow actions

Send HTTP request

This Flow Companion action allows you to send HTTP requests to a specified URL and handle the response.

Configuration

Action Parameters

  • URL (required): The endpoint to which the HTTP request will be sent. You can use variables to dynamically set the URL.
  • Body: The request payload, if applicable. For JSON payloads, you may find it convenient to prepare the data using the Run code action.

Request configuration

  • Method: The HTTP method for the request (GET, POST, PUT, DELETE)
  • Content type: The media type of the request body.
  • Authentication: The type of authentication for the request. Available options:
    • None: No authentication
    • Basic: Basic authentication using username and password
    • Bearer token: Authentication using a bearer token
    • Custom header: Authentication using a custom header

Response configuration

  • Retry on: Conditions under which the request should be retried. Available options:

    • Too many requests (429 HTTP status code): Retry if the server indicates too many requests.
  • Fail workflow on: Conditions under which the workflow should fail. Available options:

    • 3XX HTTP status codes: Fail on redirection status codes.
    • 4XX HTTP status codes: Fail on client error status codes.
    • 5XX HTTP status codes: Fail on server error status codes.
  • Data transformation: You can enable this option to customize the response using JavaScript. This is useful in cases where:

    • The HTTP response body is too large and exceeds Shopify Flow’s allowed limits — you can extract only the necessary data to reduce its size.
    • You want to enrich or modify the response by including information from the response headers.

    When enabled, you can write a JavaScript function like this:

    export default function({ body, status, headers }) {
      // transformation code
      return JSON.stringify({ /* your transformed data */ });
    }

    The function must return a string. The input parameter is an object with the following properties:

    • body: The raw response body (string)
    • status: The HTTP status code (number)
    • headers: An object containing all response headers

Output

The action returns the following fields:

  • body: The response body. Can be parsed in a Run code action for structured data processing.
  • ok: Indicates if the request was successful (status in the range 200-299). Can be used in conditions for further response handling.
  • status: The HTTP status code of the response. Can be used in conditions to handle different response scenarios.