Issue with Correctly Mapping City, State, and Country Fields in CRM via UTM Parameters

Hello Community,

I am currently working on an automation setup in Make, where we are integrating our CRM system with Mindbody API to manage leads dynamically.

The Issue:

We are trying to correctly map the City, State, and Country fields in the CRM using the cities data from Lead form . However, the City, State, and Country fields are not populating as expected, and the automation fails to display them properly.

UTM Parameters:

We have set up UTM parameters for places like Google and Facebook, but the automation isn’t reflecting the correct data for these platforms. We need help ensuring that the automation correctly identifies and associates the leads with Facebook or Google sources, particularly when populating the City, State, and Country fields.

Automated Leads Reporting:

We need an automated leads reporting system that will specify whether the leads are coming from Facebook or Google. This should be reflected in the CRM properly. We are looking for a solution that will streamline this and automate the reporting process, especially when UTM parameters are involved.

Locker Studio:

We’re considering whether Locker Studio is the right tool for this use case. Can anyone provide insights on whether it’s suitable for managing the integrations and automations related to UTM parameters and dynamic field mapping?

What We’re Looking For:

  • Help with debugging and fixing the City field mapping issue in Make and ensuring that dynamic data from UTM parameters is populated correctly.
  • Fixing the issue with lead source detection, such as Facebook or Google, and automating the reporting process.
  • Advice on whether Locker Studio would be helpful in this scenario.

Please provide your professional fees and an estimated time to resolve the issue.

If anyone has encountered this issue before or has experience troubleshooting UTM parameter-based field mapping, or automating leads reporting, any guidance or suggestions would be greatly appreciated!

Looking forward to your insights!

This is that one issues that I am having.

I’m encountering an issue when attempting to create a new client in the Mindbody API through Make. Despite providing the required fields, I receive a 400 Bad Request response with the error:

{“Error”:{“Message”:“Request was poorly formatted.”,“Code”:“MissingRequiredFields”}}

{
“FirstName”: "
“LastName”: “,”,
“Email”: "
“MobilePhone”: "
“City”: "
“State”: “”,
“Country”: “”,
“Location”: “”,
“LeadChannelId”:
“IsProspect”: true,
“ProspectStage”: {
“Active”: true,
“Description”: “New Lead”,
"
},
“SendAccountEmails”: true,
“SendPromotionalEmails”: true,
“SendScheduleEmails”: true,
“HomeLocation”: "{
“ReferredBy”: “SEO”
}

  1. LastName Field: The error suggests that there is a formatting issue or a missing required field. In particular, the LastName is currently set as ",". This could be interpreted as missing or incorrectly formatted by the API.
  2. Missing Fields: The error message MissingRequiredFields suggests that the API expects specific fields that might be missing or incorrectly named. The City field, for example, is empty in the HomeLocation section of the payload.

Next Steps:

  • Review Required Fields: Mindbody may require more fields or stricter formatting for certain fields, such as LastName, City, or HomeLocation. I need to verify the exact required fields for creating a client.
  • Ensure Data Format: The HomeLocation field seems to contain improperly formatted data. Specifically, the City field within HomeLocation is empty, which could be one of the missing fields.
  • Debug the Request: I will try sending a simpler request with only the required fields (FirstName, LastName, Email, etc.) to determine if the error is caused by missing optional fields.

Questions for the Community:

  1. Has anyone encountered this issue when working with the Mindbody API in Make or Integromat? How did you resolve it?
  2. Are there any specific required fields for the client creation endpoint in the Mindbody API that I might be missing?
  3. Is there a way to better debug the request in Make, especially for ensuring that dynamic data (e.g., 2.Location, 2.City) is correctly mappe
1 Like

Hello @arkar1

Issue 1: City, State, and Country Fields Not Populating

From what you shared, these fields are expected to be populated from UTM parameters—which usually don’t include location data unless you’re explicitly passing them in custom parameters or mapping via IP/geolocation.

Suggestions:

  1. Verify UTM Parameters:
  • UTM parameters (utm_source, utm_campaign, etc.) won’t include city/state/country unless you add custom parameters like utm_city=Chicago.
  • If you’re relying on IP-based lookup, Make won’t do that automatically unless you integrate with a geolocation API (like IPStack, MaxMind, etc.).
  1. Check Your Mapping in Make:
  • In Make, ensure the field mapping module (to your CRM) is actually referencing the correct fields.
  • If you’re using a webhook or form submission from Facebook/Google, inspect the payload to verify location data is present.
  1. Fallback Logic:
  • If city/state isn’t always present in UTM or payload, add conditional logic or filters in Make to assign default or placeholder values, or use geolocation lookups.

Issue 2: 400 Error from Mindbody API

The error you’re getting: {“Error”:{“Message”:“Request was poorly formatted.”,“Code”:“MissingRequiredFields”}}

means your JSON payload has either:

  • Incorrect formatting (extra commas, misplaced brackets),
  • Missing required fields.

Suggestions:

  1. Fix the JSON Formatting: Here’s a cleaned-up and corrected sample JSON (based on your draft):
    {
    “FirstName”: “Aktar”,
    “LastName”: “Akt”,
    “Email”: “Aktar@example.com”,
    “MobilePhone”: “+1234567890”,
    “City”: “Los Angeles”,
    “State”: “CA”,
    “Country”: “US”,
    “Location”: “Main Location ID”,
    “LeadChannelId”: 123,
    “IsProspect”: true,
    “ProspectStage”: {
    “Active”: true,
    “Description”: “New Lead”
    },
    “SendAccountEmails”: true,
    “SendPromotionalEmails”: true,
    “SendScheduleEmails”: true,
    “HomeLocation”: {
    “SiteID”: “123456”
    },
    “ReferredBy”: “SEO”
    }

  2. Watch for These Common Errors:
    LastName: “,” is invalid. It needs a real name.* HomeLocation must be an object with SiteID or similar, not a string.*
    City, State, Countryshould not be empty if required by Mindbody.* Every quote in JSON must be paired—watch for stray"or,`.

  3. Use a Simple Test Request: Try a minimal request with just required fields (Name, Email, IsProspect), then build up to your full payload.

Automated Leads Reporting (Google vs Facebook)

Make can absolutely automate this based on UTM source like utm_source=facebook or utm_source=google.

Suggestions:

  • Use Routers in Make to branch flows based on utm_source.
  • Store the source in a custom CRM field like Lead Source.
  • Create a weekly/monthly summary via:
  • Google Sheets + email
  • Dashboards in Data Studio (Looker)
  • Slack messages, etc.

Locker Studio – Is it the Right Tool?
Locker Studio is mostly good for custom app development and marketing data visualization. It’s not a native Make/Mindbody integrator.

If you’re looking to:

  • Visualize UTM campaign performance — yes, Locker could help.
  • Route and process automations like lead creation — better to stay in Make or move to something like Zapier.

If you’d like, I can help review your actual Make scenario (screenshots or modules or blueprint) or even draft the exact JSON payload for Mindbody based on your fields. Also, I can guide you on how to use IP lookup to infer City/State dynamically.

Want help with that too?

Best regards
Holiness
Holinessonyemaechi@gmail.com

1 Like

Hello Onyemaechi,

  • City and Country Mapping in CRM:
    The cities are being manually added through the leads form, but we need to ensure that the corresponding country is automatically populated in the CRM based on the city entered. Ideally, we would like to implement a system where the country field is filled based on the city.
  • Lead Source Reporting (Google, Facebook, SEO):
    We’re currently using UTM parameters to track the source of the leads, but when the data is updated in the CRM, the leads are not being reported correctly. Specifically, the LeadChannelId field, which determines whether a lead came from Facebook, Google, or SEO, needs to be parsed more accurately. The current logic isn’t capturing the leads correctly. The UTM parameters include values like utm_source and fbclid, but the mapping to LeadChannelId is inconsistent.Here’s the current code we’re using for reference:

json

Copy

"LeadChannelId": {{if(indexOf(17.Referrer; "gad_source=google") > -1; 5; if(indexOf(17.Referrer; "fbclid=") > -1; 4; 848))}},
  • Visualizing Lead Conversion Rates:
    We’re also interested in visualizing the conversion rates of these leads based on the data stored in our CRM. While we thought Locker Studio might be a good option, we would appreciate your opinion on whether it’s the best fit for this scenario or if there are other tools that might work better for our reporting needs.

I also sent you the more details in the email as well.
Thank you

Hi @arkar1 ! I would love to help you with debugging this.

We are a small team of make.com experts and have developed plenty of complex integrations. This project should not be a challenge to us.

If you are interested we would love to help you, you can schedule a call in here: 30 Min Meeting | Felipe Saucedo | Cal.com or check our website www.aspirity.com