Hi My goal is to get SMS consent after subscription of a Klaviyo signup form. I want to use Zapier since Klaviyo do not sent OPT-IN to europe contries.
I have followed this guide:
https://help.klaviyo.com/hc/en-us/articles/4407486310683-How-to-Send-Consent-to-Klaviyo-via-Zapier
When testing the code in Zapier no errors happens. However inside Klaviyo the profiles do not get marked with SMS-consent. Do any of you guys know any common issues and a fix? :-)
Underneath you can see a screenshot of my code in Zapier:
Heres the code:
import requests
url = "https://a.klaviyo.com/api/v2/list/WXxhcB/subscribe"
querystring = {"api_key":"pk_fd3964481165b5fd3ee112dafea8f7dd7b"}
# configuring sms_consent mapping to boolean value
if (input_datad"sms_consent"] == "true" or input_datad"sms_consent"] == "True" or input_datad"sms_consent"] == "TRUE"):
sms_consent = True
elif (input_datad"sms_consent"] == "false" or input_datad"sms_consent"] == "False" or input_datad"sms_consent"] == "FALSE"):
sms_consent = False
payload = {"profiles": s
{"email": input_datad"email"], "phone_number": input_datad"phone_number"], "sms_consent": input_datad"sms_consent"]}
]}
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}
Best regards
Lasse, Lykke by Lykke