Make HTTP 400 Bad Request to SGTM/Meta CAPI – Invalid JSON/User Data Mapping

Make HTTP 400 Bad Request to SGTM/Meta CAPI – Invalid JSON/User Data Mapping


Hello Make Experts,

I’m facing a persistent Error 400 Bad Request when sending a Typeform Lead event via Make’s HTTP module to my Stape/sGTM tagging server.

I have completed the full SST setup, but the final request fails validation at the Meta API level.

:pushpin: Setup Details:

  • Flow: Typeform Webhook → Tools (Set Variables for Hashing/Time) → HTTP (POST to sGTM).

  • sGTM Endpoint: https://sgtm.ivanmahalel.com/collect (Verified and Ready).

  • Issue: The HTTP module receives Error 400. This implies the JSON is being validated by sGTM but is invalid according to Meta’s requirements.

:magnifying_glass_tilted_left: Suspected Root Cause (Need Eyes on JSON Mapping):

My primary suspicion is that the HTTP module is incorrectly sending the hash/time values with the wrong syntax (e.g., sending template strings instead of pure values) or missing crucial identifiers needed for CAPI validation.

1. Hashing/Time Mapping Error: The event_time, em, and ph fields might be wrongly serialized in the JSON: * Goal: {"em": ["a3d9..."], "event_time": 1730...} (Pure string/integer values) * Current Issue: Potential extra quotes around the hash/time variables, or the formatDate output is not being processed correctly as an integer.

2. Missing Required Identifiers: The 400 might be due to Meta rejecting the Server-to-Server event because of missing client identifiers. I’m injecting dummy values for testing: * client_user_agent (Injected via Set Variable) * client_ip_address (Injected as 8.8.8.8)

:hammer_and_wrench: Request to the Community:

Could someone with experience with Make.com → Server-Side GTM/CAPI please review the necessary syntax for injecting values from Set Variable (Tools) modules into the final HTTP JSON?

Specifically, should the variables be wrapped in quotes ("{{variable}}") or sent raw ({{variable}}), given they contain a hashed string and a Unix integer?

Any quick fix suggestions for the JSON formatting that commonly causes the 400 error would be highly appreciated.

Thank you!

Hey Ivan,

try with a Create a JSON module instead of Set Variables. Then send the JSON directly.

1 Like

Welcome to the Make community!

Escaping strings before mapping into another JSON string

Most of the time, you cannot directly map variables containing text content into another JSON string without escaping them, as the variable might contain characters that have a special meaning in JSON.

Special characters in strings needs to be specified (escaped) as a “literal” character (instead of a special metacharacter), otherwise they make the whole JSON invalid when you map the variable value when creating another JSON string.

You can escape string variables by passing the text into the JSON “Transform to JSON” module —

Transforms any object to JSON.

Then, you can map the output of the “Transform to JSON” module into your JSON string. (Do note that when using the “Transform to JSON” module, the output should already contain the double quotes " " around your text, so when you map this output into your JSON, you should not need to wrap another pair of double quotes around it.)

Alternatively, you can use the built-in function replace to replace those special characters with their escaped versions, as discussed here.

For more information on escaping JSON strings, see: Understanding JSON Escape: A Comprehensive Guide

Hope this helps! If you are still having trouble, please provide more details.

@samliew
P.S.: investing some effort into the tutorials in the Make Academy will save you lots of time and frustration using Make!