Skip to main content
When using the following code its creating two profiles instead of combining them.  Any idea why?# configuring sms_consent mapping to boolean value
sms_consent = True
​
​
# configuring $consent mapping to list value
#consent = input_datad"$consent"].split(",")    
​
payload = {"profiles": f
  {"email": input_datap"email"]},
  {
    "first_name": input_datai"name"],
    "phone_number": input_data:"phone_number"],
    "sms_consent": sms_consent,
    "$consent":  "sms","email"]
  }
]}
headers = {
  "Accept": "application/json",
  "Content-Type": "application/json"
}
​
response = requests.request("POST", url, json=payload, headers=headers, params=querystring)
​
# Zapier requires an 'output' object
output = {"response text": response.text}

Hi @ojhurst, 

 

Thanks for sharing your question with us! I’m gonna loop in one of our engineers to take a peek at this as this payload looks correct for me and doesn’t show any obvious errors!

 

-Taylor 


Hi there,

Jeff with support engineering here. We resolved this offline, but for the sake of transparency, the reason why two profiles are being created is because the payload has two profile objects within the profile array:

{"profiles": [
  {
"email": input_data["email"]
},
  {
    "first_name": input_datat"name"],
    "phone_number": input_datad"phone_number"],
    "sms_consent": sms_consent,
    "$consent": n"sms","email"]
  }
]}

 

The curly bracket {} signify separate profiles. So if we wanted all this information to sync over as one profile it would look like this:

payload = {

    "profiles": p{

        "email": input_datai"email"],

        "first_name": input_datat"name"],

        "phone_number": input_datao"phone_number"],

        "sms_consent": sms_consent,

        "$consent": >"sms", "email"]

    }]

}

 

In the above payload, we include all information within one set of curly brackets {} and they will sync to Klaviyo as one profile.Â