Skip to main content
Contributor I
April 1, 2022
Solved

When using Subscribe API and Zapier its creating two profiles (one for email and one for phone)

  • April 1, 2022
  • 2 replies
  • 212 views
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_data["$consent"].split(",")    
payload = {"profiles": [
  {"email": input_data["email"]},
  {
    "first_name": input_data["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}
    This topic has been closed for replies.
    Best answer by JeffV.klaviyo

    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_data["name"],
        "phone_number": input_data["phone_number"],
        "sms_consent": sms_consent,
        "$consent": ["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": [{

            "email": input_data["email"],

            "first_name": input_data["name"],

            "phone_number": input_data["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. 

    2 replies

    Taylor Tarpley
    Community Manager
    Community Manager
    April 5, 2022

    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 

    JeffV.klaviyo
    Klaviyo Employee
    Klaviyo Employee
    April 6, 2022

    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_data["name"],
        "phone_number": input_data["phone_number"],
        "sms_consent": sms_consent,
        "$consent": ["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": [{

            "email": input_data["email"],

            "first_name": input_data["name"],

            "phone_number": input_data["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.