How can we help?

Search for answers to your questions by entering keywords below, or look through our knowledge base.

Transforming Data in Zapier

Follow

Transforming Your Collected Data into the Club OS Format

Depending on the data that you are collecting you may need to transform the data prior to sending it into Club OS.  The following values may need to be transformed using the steps below:

  • Phone numbers (home, mobile, work) - If your form includes a phone number field that includes parentheses and/or hyphens you may need to first reformat it so that data will be sent to Club OS successfully.  You can typically use the built-in Zapier Numbers converter but for some apps additional code will be required.
  • Email or SMS Opt-In - If your form includes a checkbox to opt-in or out of email or SMS, you must reformat it to send values of 'True' or 'False' instead of 1 or 0. 

In this case, you will need to add a step for ‘Code By Zapier’ between your lead capture app and Club OS. This will allow you to put the data in the correct format.  After selecting the 'Code by Zapier' app, in the ‘Choose Action Event’ select ‘Run Python’.

Edit_Step___Zapier.jpg

Phone Number Transformation

Within the Code By Zapier > Run Python action:

  1. Add an input data variable for each phone number that you are collecting on your form.  We recommend using the following naming conventions: mobilePhone, homePhone, workPhone.  
  2. Select the field from your form that matches the input data name you have assigned
  3. In the code field, enter the code below that corresponds with the phone numbers you are capturing on your form:
    Note: If you have decided to use your own naming conventions, they will need to be updated in the code below.

Mobile Only

import re

output = {
'mobilePhone': None
}

if input.get('mobilePhone'):
output['mobilePhone'] = re.sub("[^0-9]", "", input.get('mobilePhone'))

Mobile & Home Phone

import re

output = {
'mobilePhone': None
'homePhone': None
}

if input.get('mobilePhone'):
output['mobilePhone'] = re.sub("[^0-9]", "", input.get('mobilePhone'))
if input.get('homePhone'):
output['homePhone'] = re.sub("[^0-9]", "", input.get('homePhone'))

Mobile, Home Phone & Work Phone

import re

output = {
'mobilePhone': None
'homePhone': None
'workPhone': None
}

if input.get('mobilePhone'):
output['mobilePhone'] = re.sub("[^0-9]", "", input.get('mobilePhone'))
if input.get('homePhone'):
output['homePhone'] = re.sub("[^0-9]", "", input.get('homePhone'))
if input.get('workPhone'):
output['workPhone'] = re.sub("[^0-9]", "", input.get('workPhone'))

 

Using Email or SMS Opt-Out in Forms

Before using the steps below it is important to consider how your consent to email/text is worded on your form.  For example:

  • Opt-In - If your form says 'I would like to receive email marketing' , by selecting this the client is opting IN to your communications. The field for 'Opt Out of Email' would be set to False.
  • Opt-Out - If your form says 'Opt out of marketing emails' , by selecting this the client is opting OUT of your communications. The field for 'Opt Out of Email' would be set to True.

For this reason, the selection being checked can mean two very different things and it is important to use the appropriate steps below based on your usage.  Club OS stores values as Opt Out = True or False so if someone has opted into messages we would pass the value as Opt Out = False.

Email or SMS Opt-Out Transformation

Within the Code By Zapier > Run Python action:

  1. Add an input data variable for each opt in that you are collecting on your form.  We recommend using the following naming conventions: emailOptOut, textOptOut.  
  2. Select the field from your form that matches the input data name you have assigned
  3. In the code field, enter the code below that corresponds with the opt-outs you are capturing on your form:
    Note: If you have decided to use your own naming conventions, they will need to be updated in the code below.

Email Opt In/Out Only 

import re
output = {
'emailOptOut': None,
}
# Delete the section below that does not apply to you
# Below code should be used if your marketing is worded as an opt-in instead of an opt-out
output['emailOptOut'] = 'False' if input.get('emailOptOut') == "1" else 'True'

# Below code should be used if your marketing is worded as an opt-out
output['emailOptOut'] = 'False' if input.get('emailOptOut') == "0" else 'True'

SMS Opt In/Out Only 

import re
output = {
'textOptOut': None
}
# Delete the section below that does not apply to you
# Below code should be used if your marketing is worded as an opt-in instead of an opt-out
output['textOptOut'] = 'False' if input.get('textOptOut') == "1" else 'True'

# Below code should be used if your marketing is worded as an opt-out
output['textOptOut'] = 'False' if input.get('textOptOut') == "0" else 'True'

Email & SMS Opt In/Out

import re
output = {
'emailOptOut': None,
'textOptOut': None
}

# Delete the section below that does not apply to you
# Below code should be used if your marketing is worded as an opt-in instead of an opt-out
output['emailOptOut'] = 'False' if input.get('emailOptOut') == "1" else 'True'
output['textOptOut'] = 'False' if input.get('textOptOut') == "1" else 'True'

# Below code should be used if your marketing is worded as an opt-out
output['emailOptOut'] = 'False' if input.get('emailOptOut') == "0" else 'True'
output['textOptOut'] = 'False' if input.get('textOptOut') == "0" else 'True'
Was this article helpful?
0 out of 0 found this helpful

Comments