Sending HTTP requests in your workflows

You can create workflows that send HTTP requests to external web servers, API endpoints, and URLs. For example, you could create a workflow that sends a message to a messaging service, or that creates an item in a project management app.

Your HTTP request can support the following HTTP methods:

  • Get - Sends a request for information from the server.
  • Delete - Removes a resource from the server.
  • Head - Retrieves the HTTP response headers of the server.
  • Options - Retrieves the options and features that are supported by the server.
  • Patch - Partially updates a resource on the server.
  • Put - Updates a resource on the server.
  • Post - Creates or replaces a resource on the server.

After Shopify Flow sends your HTTP request it waits for a maximum of 30 seconds for your app to respond with an HTTP status code. If after 30 seconds Shopify Flow hasn't received a response from your app, then it closes the connection to your app and it resends the request.

When Shopify Flow receives a response, it processes the codes as follows:

Status codes How Shopify Flow processes them
200 Success Shopify Flow assumes that the POST request has been processed by your app.
202 Success Shopify Flow assumes that the POST request has been accepted by your app.
4XX Client errors

If your app sends a 429 (too many requests) status code without a Retry-After header, then Shopify Flow resends the HTTP request (POST) at increasing intervals for up 24 hours.

If your app sends a 429 (too many requests) status code with a Retry-After header (that specifies a wait time), then Shopify Flow resends the HTTP request (POST) after the wait time (formatted in seconds) has passed.

If your app sends any other 4XX code, then Shopify Flow assumes that there was a failure and it does not resend the POST request.

5XX Server errors Shopify Flow resends the HTTP request (POST) at increasing intervals for up 24 hours.
Other status code If your app returns a code that isn't described in this table, then Shopify Plus assumes that there was a failure and it does not resend the POST request.

Limitations and known issues

Although this HTTTP request feature is similar to the HTTP requests that can be created with actions in Shopify Flow Connectors, these features are different. For example, these HTTP requests don't include an action_run_id in their headers.

Also, this feature processes 202 status codes as though the request was processed.

To create an action that makes an HTTP request

  1. In your workflow, click Add action.
  2. Select Send HTTP request.
  3. From the HTTP method drop-down menu, fill in the fields as follows:

    1. Select one of HTTP methods.
    2. In the URL field, specify the URL of the server. If you need to pass parameters in your URL, then specify them in the Headers table.
    3. In the Body field, add the content that you want to send to the server. When you send messages, it is often helpful to include details about the customer, order, or product involved. To do this, you need to use template variables. See Template variables.
    4. Click Save.

Examples

In the following example, the workflow sends information about gift cards:

A workflow that posts information about gift cards to a server.

Learn more

Ready to start selling with Shopify?

Try it free