Solved

Add/update SMS consent with zapier

  • 5 October 2022
  • 3 replies
  • 307 views

Badge +1

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_data["sms_consent"] == "true" or input_data["sms_consent"] == "True" or input_data["sms_consent"] == "TRUE"):
sms_consent = True
elif (input_data["sms_consent"] == "false" or input_data["sms_consent"] == "False" or input_data["sms_consent"] == "FALSE"):
sms_consent = False

payload = {"profiles": [
{"email": input_data["email"], "phone_number": input_data["phone_number"], "sms_consent": input_data["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

icon

Best answer by Brian Turcotte 10 March 2023, 04:37

View original

3 replies

Userlevel 7
Badge +58

Hi there @lykkebylykke ,

Unfortunately, passing SMS Consent with Zapier into Klaviyo is not possible at this time. It would need to be done through an API call. We would recommend working with a developer or if you yourself are a developer, then we would recommend reviewing this section of the doc to understand how to subscribe & pass SMS consent in your API request:https://apidocs.klaviyo.com/reference/lists-segments#subscribe
 
If you do not have access to a developer, then please consider our robust community of partner agencies to assist with this. You can browse our Klaviyo Agency Directory to decide which option is best suited for you.

Badge +2

@alex.hong Why are you saying passing SMS consent with Zapier is not possible considering the Zapier support article that @lykkebylykke linked to? According to this support doc it is.  

https://help.klaviyo.com/hc/en-us/articles/4407486310683-How-to-send-consent-to-Klaviyo-via-Zapier

Right now I’m experiencing an issue were SMS consent is being sent to Klaviyo from Zapier, but email consent is not. I’m troubleshooting but confused why you said that. 

Userlevel 7
Badge +36

Hi @addison

 

Adding SMS consent via Zapier is a relatively new feature, which in the past would constitute an API integration. I see that you managed to solve this issue in your other thread here, so I’m going to post it below so others in the Community can follow along if they run into the same issue:

 

Thanks so much for sharing your resolution with the Community!

- Brian

Reply