separate first name and last name

Rianto

New Member
Hi support,

currently, i import my list from getresponse to mailwhizz, but the name is imported as [NAME]. I usually send email using firstname as tag (on getresponse will be {{firstname}}). The question, how can i separate the name into [FNAME] and [LNAME] easily.

and how to make form (usually contain 2 colomn : name and email), so when user input the name, it'll automatically become [FNAME] and [LNAME] (if user fill in full name) or just [FNAME] if user only fill one word name.

Thanks
 

twisted1919

Administrator
Staff member
Hi,

If your csv file has proper column names, that is the name is separated into First name / Last name, then mailwizz will figure it out and insert proper data in proper column.
If your csv file doesn't have these columns, but only has a NAME column, then this is the result, a new tag will be created to accommodate your NAME data.

Simply put, it's really up to your csv file..
 

Rianto

New Member
and how to make form (usually contain 2 colomn : name and email), so when user input the name, it'll automatically become [FNAME] and [LNAME] (if user fill in full name) or just [FNAME] if user only fill one word name?
 
Technically, there IS a magic way:
https://github.com/joshfraser/PHP-Name-Parser

Incoming data called FULLNAME could trigger that filter, which would then parse FNAME and LNAME values?

I'm willing to help pay for such an extension if anybody's got the chops.
A few more related links:
https://stackoverflow.com/questions/5596706/parsing-a-full-name-into-its-constituents
https://www.npmjs.com/package/parse-full-name

This paid API offers low volume daily limits for free -- with a chance to increase your free credits by sharing, referring, reviewing, back-linking, etc. https://www.nameapi.org/en/demos/name-parser/
 

sendmedialtd

Active Member
Can you show me an example of the names. For example are they like this:

Mark White (in the same column)
Or
MarkWhite (in the same column)
 
@sendmedialtd , well, that's the question, right? there are a LOT of off-the-shelf lead generation packages (pop-ups, sign-up forms, etc) that -- for some unknown reason -- prefer "Name" to "FIrst Name" and "Last Name" fields. Of course, this then leads you with essentially unusable data, because I can't say "Dear Bob", I end up saying "Dear Mr. Bob J. Smith III" and looking stupid.

The idea with a full name parser would be that it could look at any incoming field named FULLNAME, ingest the data and spit back the FNAME and LNAME. (I personally am less interested in the Mr., J., or III from my example.)
 
Can you show me an example of the names. For example are they like this:

Mark White (in the same column)
Or
MarkWhite (in the same column)
to answer specifically, though, it's less about misconfigured data (like missing spaces) and more about parsing an incoming FULLNAME into its component FNAME and LNAME.
 

sendmedialtd

Active Member
Yeah i understand but how does the data look for fullname? Which of the 2 examples or something else does do you get the data?
 
the incoming FULLNAME would look like "Mark Smith" or "Jane Doe" or "J. James Jones" or "Bob" or "F**k Off", etc -- what we would expect from any free form text field on the Internet. I think that we could reasonably deal with all of those scenarios, though...
 
LOL. For an import file, of course, that be the way to do it. I'm thinking about a data stream that is feeding us leads, but is collecting a single name field vs. fname and lname separately. The goal would be to build the parser into the import engine.

If the importer finds a field called FULLNAME, it would run it through the PHP Name Parser to split off FNAME and LNAME. There are a HUGE number of 3rd party lead generating forms/popups/hijacks/etc. and a LOT of them seem to prefer asking for a single name field to First and Last. (I assume because they think 2 fields converts better than 3.) Keep an eye out for it. You'll be surprised by how many ask for a single name field. (It's all AWeber's fault...)

Just something I thought I'd add to the discussion. Depending on how you source your leads, there's a legitimate marketing need for it.
 

sendmedialtd

Active Member
Aaaaaah right I understand now, didn't know you was talking about having records added via the API. There's 2 ways you can do this:

1) @twisted1919 could create something (feature request) where people could select a value in the backend to be split up from the API settings. For example in the API settings lets say i want custom field FULLNAME to be split into 2 based off the first space in the data. Id then select the field i want the first part of the data to go into (FNAME) and then the second i select to go into (LNAME). Splitting a value in PHP is a simple thing to do for example:

PHP:
$array = explode(' ', $string, 2);
Obviously there's alot of other work to be done to create this and if he does decide to do this I wouldn't except it anytime soon due to other priorities.

2) You could do the above yourself in a way, create a simple PHP API Relay and your API splitting the values up and THEN passing the data to the MailWizz API VIA CURL with the correct FNAME and LNAME data. Simple script to make if you'd like me to do this for you?
 

sendmedialtd

Active Member
It's 2:40am here in England and I'm currently relaxing in bed. I have a meeting in the morning too so I'll probably only be able to start coding the script for you around 2pm GMT. Shouldn't take me too long to do though as it's quite simple :)
 

sendmedialtd

Active Member
Something along the lines of this:

PHP:
<?php
//MailWizz API Relay - by Mike Walmsley (sendmedialtd)
$FullName = $_GET['FullName'];
$Email = $_GET['Email'];

$array = explode( ' ', $FullName, 2 );

//Relay the API to your MailWizz API
//
function httpPost($url,$params)
{
  $postData = '';
   //create name value pairs seperated by &
   foreach($params as $k => $v)
   {
      $postData .= $k . '='.$v.'&';
   }
   $postData = rtrim($postData, '&');
 
    $ch = curl_init(); 
 
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($ch,CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_POST, count($postData));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);   
 
    $output=curl_exec($ch);
 
    curl_close($ch);
    return $output;
 
}

$params = array(
   "EMAIL" => $Email,
   "LNAME" => $array[0],
   "FNAME" => $array[1]
);
 
echo httpPost("YOUR-MAILWIZZ-API-URL.com",$params);
//
//End of API Relay to MailWizz API

//MailWizz API Relay - by Mike Walmsley (sendmedialtd)
?>
 

sendmedialtd

Active Member
If your getting the data via POST then simply just change

PHP:
$FullName = $_GET['FullName'];
$Email = $_GET['Email'];
to the following:

PHP:
$FullName = $_POST['FullName'];
$Email = $_POST['Email'];
Also make sure your POST/GET names match whats being sent to you.

PS: I've never used the MW API myself so not sure if this will work but hopefully it will :)
 
Top