Welcome to our newly overhauled Zephyr pages! See our new Overview, Examples, and Index.
Feedback is welcome at bottom of each page.


Returns the first element or word of a list or string.

mixed first( mixed input [, string prior])

If passed a list, returns the first element of that list. If passed a string, returns the first word in that string (using spaces as the separator). This can be useful for extracting a user’s first name from the name property. Optionally, you can pass a second string parameter to return the string value before the first instance of prior.


{first([1, 2, 3])}    ---> 1
{first('Joe Smith')} ---> Joe
{first('Mrs. Meyer','.')} ---> Mrs
{first('Mrs. Meyer','eyer')} ---> Mrs. M

If the variable name is set on your subscribers and it includes both their first and last names, you could use this in a template to call just the user’s first name:

Dear {first(name)},

Display User’s First Name from Full-Name Field

Use Case: If you’re collecting a full_name variable on the user and would like a friendlier salutation, first() will return only the first item in the string. For example, if a user’s full_name variable is “John Smith,” the first() function will output “John.”

Zephyr: "Hello, {first(full_name)}!"

Output: "Hello, John!"

Explanation: This script uses the first() function to check the first element in an array or string, in this instance a “full_name” user variable, to return only the first element, i.e. the user’s first name.

Zephyr Example – Display Data Feed Content Links with First Article as Featured

Have a Dynamic Welcome Message Based on Last List Signup

Use Case: Within a Welcome email, you want to display the name of the Natural List a user most recently signed up to. Using push() in conjunction with sort(), you can display the name of the most recent Natural List a user was added to.


{lists = []}
{foreach profile.lists_signup as k,v}
{listName = first(sort(lists,'-time')).name}
Thank you for signing up to our {listName} list!

Output: Thank you for signing up to our Daily Newsletter list!

Explanation: This script loops through the “lists_signup” parameter on each user’s “profile object,” assigning two temporary values: “k” (the key, in this instance, the list name) and “v” (the value, in this instance, the list signup time). We then use the push() function to add those values as “name” and “list” into an array called “lists.” Next, a a local variable called “listName” is created, and for the value, the sort() function orders this array by newest to oldest list signup time (“-time”), and then isolates the first value, i.e. the latest list the user signed up to. The {listName} variable is then displayed in the welcome message in the template.