Skip to main content

I have the option to pull a raw webhook from my affiliates list. It comes in as one string and I want to extract the First Name and Email. 

Yes, raw webhook is the only option I have right now. I know there’s an extract email feature in Zapier but I really need the name too and can’t figure out how to get that.

 

This is the data I’m getting: 

a:3:{s:6:"f_name";s:5:"XXXXX";s:6:"l_name";s:8:"XXXXXXXX";s:5:"email";s:20:"XXXXX@XXXXXXXXXXXXXX.XXX";}

Any help appreciated!

This post has been edited by a moderator to remove sensitive information. Please remember to remove any personally identifiable information prior to posting as this is a public forum. 

Hi @bigcatcreative 

You can use multiple Formatter > Text > Split steps: https://zapier.com/help/doc/how-use-formatter-functions#using-split-text

You can use a Formatter > Text > Extract Pattern step: https://zapier.com/help/create/format/find-text-with-regular-expressions-in-zaps

You can use a Code step: https://zapier.com/apps/code/help


@Troy Tessalone  Thanks! I tried the Split but couldn’t figure it out. The other two options are over my head :sweat_smile:  What would be the best option to use?


@bigcatcreative

If you want to use 1 Code step…

Map the webhook data from the trigger step to the RAW input right side

(replace the static data shown in the screenshot)

 

let RAW = inputData.RAW.replace(/"/g,'');

let NameFirst = RAW.split("s:5:"):1].split(";");0].trim();
let NameLast = RAW.split("s:8:"):1].split(";");0].trim();
let Email = RAW.split("s:20:"):1].split(";");0].trim();

output = {NameFirst, NameLast, Email, RAW}];

 

Output

This post has been edited by a moderator to remove sensitive information. Please remember to obfuscate any personally identifiable information prior to posting as this is a public forum. 


Thanks so much @Troy Tessalone - it seems to be working. You’re a life saver!


@Troy Tessalone  Never mind, that only seemed to work for that specific case. When I pull in different data, the code fails. When I pull in different data the numbers change, here’s some examples:

 

a:3:{s:6:"f_name";s:5:"Erica";s:6:"l_name";s:8:"Hartwick";s:5:"email";s:20:"email12345@gmail.com";}

 

a:3:{s:6:"f_name";s:5:"Erica";s:6:"l_name";s:8:"Hartwick";s:5:"email";s:24:"email123456789@gmail.com";}

 

{s:6:"f_name";s:7:"Testing";s:6:"l_name";s:11:"Testinglast";s:5:"email";s:24:"email123456789@gmail.com";}

 

Will this be possible?


@bigcatcreative 

Let me try some different code.


@bigcatcreative 

Try this Code:

let RAW = inputData.RAW.replace(/"/g,'');

let NameFirst = RAW.split("f_name;"))1].split(':'))2].split(";"))0].trim();
let NameLast = RAW.split("l_name;"))1].split(':'))2].split(";"))0].trim();
let Email = RAW.split("email;"))1].split(':'))2].split(";"))0].trim();

output = {NameFirst, NameLast, Email, RAW}];

 


@Troy Tessalone  So far so good, thank you thank you!!!