Flowboost Question | Community
Skip to main content
May 2, 2018
Question

Flowboost Question

  • May 2, 2018
  • 1 reply
  • 2772 views

I have 10 url fields that need to have the removed I was hoping to achieve this with flowboost and some regex "var url = url.replace(/(^\w+:|^)\/\//, '');"

My question is, can I make one webhook for all 10 fields or will I need to make one for each?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
May 2, 2018

Hey Roger,

You can definitely do them all at once! And if you just want the hostname (www.example.com) without the protocol, you can use FBHttp.parseUrl (a built-in) shortcut instead of a regex:

var urls = {

    Website1 : FBHttp.parseUrl({{Lead.Website1}}).hostname,

    Website2 : FBHttp.parseUrl({{Lead.Website2}}).hostname,

    Website3 : FBHttp.parseUrl({{Lead.Website3}}).hostname

};

(Then set your response mappings for urls.Website1, urls.Website2, etc.)

May 2, 2018

Would FBHttp return linktrack.info/.2sa0d from linktrack.info/.2sa0d?

Also would this be the right direction if they may be null?

Var urls = {

url1  : {{lead.twitter}},

url2  : {{lead.facebook}},

url3  : {{lead.instagram}},

url4  : {{lead.pinterest}},

url5  : {{lead.zillow}},

url6  : {{lead.realtor}},

url7  : {{lead.trulia}},

url8  : {{lead.craigslist}},

url9  : {{lead.landingpage}},

url10 : {{lead.youtube}}

}

For (var uri in url) {

if (urls[uri] !== null && urls[uri] !==''){

urls[uri] : FBHttp.parseUrl{urls[uri]}.hostname;

}

}

or would it be?

Var urls = {

twitter     : FBHttp.parseUrl{{{lead.twitter}}}.hostname,

facebook    : FBHttp.parseUrl{{{lead.facebook}}}.hostname,

instagram   : FBHttp.parseUrl{{{lead.instagram}}}.hostname,

pinterest   : FBHttp.parseUrl{{{lead.pinterest}}}.hostname,

zillow      : FBHttp.parseUrl{{{lead.zillow}}}.hostname,

realtor     : FBHttp.parseUrl{{{lead.realtor}}}.hostname,

trulia      : FBHttp.parseUrl{{{lead.trulia}}}.hostname,

craigslist  : FBHttp.parseUrl{{{lead.craigslist}}}.hostname,

landingpage : FBHttp.parseUrl{{{lead.landingpage}}}.hostname,

youtube     : FBHttp.parseUrl{{{lead.youtube}}}.hostname

}

SanfordWhiteman
Level 10
May 2, 2018

For that, you'd append the .path:

var urls = {

    Website1 : FBHttp.parseUrl({{Lead.Website1}}).hostname + FBHttp.parseUrl({{Lead.Website1}}).path,

    Website2 : FBHttp.parseUrl({{Lead.Website2}}).hostname + FBHttp.parseUrl({{Lead.Website2}}).path,

    Website3 : FBHttp.parseUrl({{Lead.Website3}}).hostname + FBHttp.parseUrl({{Lead.Website3}}).path

};   

Or you could do that much less repetitively with some looping, but this should get you going.