Sending HTTP requests in your workflows

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.

Response codes

After 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 Flow hasn't received a response from your app, then it closes the connection to your app and it resends the request.

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

How Flow processes status codes.
Status codes How Flow processes them
200 Success Flow assumes that the POST request has been processed by your app.
202 Success 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 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 Flow resends the HTTP request (POST) after the wait time (formatted in seconds) has passed.

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

5XX Server errors 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

Do not confuse this HTTP request action with app actions that are created with Flow connectors. Both features send HTTP Requests, but there are differences between them. For example, the HTTP request that is sent with this action doesn't include an action_run_id in its header.

It is a known issue that this action processes 202 status codes as though the request was processed.

Sending an HTTP request

  1. In your workflow, click Add action.
  2. Select Send HTTP request.
  3. From the HTTP method section, fill in the fields as follows:
    1. Select one of HTTP methods.
    2. In the URL field, enter the URL of the server.
    3. Optional: If the API you pass information to requires information to be added to the URL, then do the following:
      • If the API requires information in the header, then specify parameters in the Headers table to pass them to the URL. If the API allows information to be added to either the header or the URL path, then use the header. This option is more secure than adding information to the URL path.
      • If the API requires information in the URL path, then add template variables to the path portion of the URL. The path portion of the URL is located after the third forward slash. For example, in the URL https://shopify.com/{{order.id}}, the path portion is {{order.id}}.
  4. In the Headers field, add any key-value pairs. You can also add template variables to the key or to the value.
  5. In the Body field, add the content that you want to send to the server. When you send messages, it's useful to include details about the customer, order, or product involved. To do this, you need to use template variables.
  6. Click Save.

Ready to start selling with Shopify?

Try it free