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.
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.|
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
- In your workflow, click Add action.
- Select Send HTTP request.
From the HTTP method drop-down menu, fill in the fields as follows:
- Select one of HTTP methods.
- 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.
- 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.
- Click Save.