Assistance Needed - Shopify Flow HTTP POST Request Issue

Topic summary

A user encountered a “Bad Request” error when sending HTTP POST requests from Shopify Flow to a Python API upon order creation. The issue stemmed from improperly formatted JSON payloads using Liquid variables, resulting in extra braces and unwanted characters.

Solution Provided:

  • Use the Liquid | json filter to properly escape values and eliminate manual quoting
  • Set the Content-Type header correctly for POST requests in Shopify Flow
  • Example format: {"first_name": {{ order.billingAddress.firstName | json }}}

Alternative Resolution:
Another participant resolved a similar issue with Mailgun by:

  • Using multipart/form-data format: key1=value1&key2=value2
  • Not setting the Content-Type header (Mailgun-specific requirement)

Status: Resolved with working solutions for both standard JSON APIs and form-data endpoints.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

I am currently facing challenges with the Shopify Flow app while attempting to send an HTTP POST request to my Python API upon order creation. The issue revolves around constructing the JSON payload using liquid variables, leading to a “Bad Request” error.

Details:

Attempts with different JSON payload constructions, including {first_name:{{order.billingAddress.firstName}}}, {first_name:“{{order.billingAddress.firstName}}” and {first_name:{{order.billingAddress.firstName}}, have resulted in extra closing braces or unwanted characters (“{"first_name":"karanveer"”}").

Request for Assistance:

I request guidance to resolve the syntax error in the JSON payload for the Shopify Flow HTTP POST request. Any best practices or guidelines for constructing JSON payloads using liquid variables in Shopify Flow would be highly appreciated.

Your prompt attention to this matter is crucial for the optimal functioning of our Shopify store.

Thank you for your assistance.

Best regards,

Karanveer Singh
kaveer@legitbytes.com

For anyone who lands here and is facing a similar issue when using a POST request with shopify flow.

The simplest way to future proof and send your data would be to make sure you’re using the liquid JSON filter in your request body, it will eliminate the need to place the data in quotes and any character escaping.

The request body would look like the following

{
  "first_name": {{ order.billingAddress.firstName | json }},
  "last_name": {{ order.billingAddress.lastName | json }}
}

it Doesn’t work.

Are you setting the Content-Type headers, flow HTTP requests need their headers set properly.
A simple POST request would look like this in Shopify Flow, I just tested this to confirm with a webhook testing service.

1 Like

I’ve solved it.
The problem is that I am using mailgun and it accepts multipart/form-data, so I had to use the format key1=value1&key2=value2.
The content-type should not be set or it doesn’t work.