Embed Variables

Variables can be used in Discord Webhook messages and the view route to customize the message with dynamic content. Variables also allow you to use modifiers to format the content in a specific way.

Format

{variableName.property::modifier::secondModifier?}

Available Variables

User

AccessTypeDescription
{user.id}stringThe user's ID
{user.createdAt}dateThe user's creation date
{user.updatedAt}dateThe user's last update date
{user.username}stringThe user's username
{user.role}stringThe user's role: USER | ADMIN | SUPERADMINISTRATOR

File

These variables are only available in the case of anything related to files.
AccessTypeDescription
{file.id}stringThe file's ID
{file.createdAt}dateThe file's creation date
{file.updatedAt}dateThe file's last update date
{file.deletesAt}?dateThe file's expiration date
{file.favorite}booleanIf the file is favorited
{file.name}stringThe file's name
{file.originalName}?stringThe file's original name
{file.size}numberThe file's size in bytes
{file.type}stringThe file's type
{file.views}numberThe file's views
{file.maxViews}?numberThe file's max views
{file.folderId}?stringThe file's folder ID

URL

These variables are only available in the case of anything related to URLs.
AccessTypeDescription
{url.id}stringThe URL's ID
{url.createdAt}dateThe URL's creation date
{url.updatedAt}dateThe URL's last update date
{url.code}stringThe URL's code
{url.vanity}?stringThe URL's vanity
{url.destination}stringThe URL's destination
{url.views}numberThe URL's views
{url.maxViews}?numberThe URL's max views

Link

These variables are only available on the onUpload and onShorten events.
AccessTypeDescription
{link.returned}?stringThe returned link when a file is uploaded or a URL is shortened
{link.raw}?stringOnly available on the onUpload event, this will be the raw file link

User Metrics

These are variables to access user metrics.
AccessTypeDescription
{metricsUser.files}numberThe user's total files
{metricsUser.urls}numberThe user's total URLs
{metricsUser.storage}numberThe user's total storage in bytes
{metricsUser.fileViews}numberThe user's total file views
{metricsUser.urlViews}numberThe user's total URL views

Modifiers

To use modifiers, you need to add them after the variable with a double colon ::. For example to format a date to UTC time you would use {user.createdAt::utc}.

string modifiers

ModifierDescriptionExample
upperUppercase the stringaBcDABCD
lowerLowercase the stringaBcDabcd
titleTitle case the stringaBcDAbcd
lengthGet the string lengthaBcD4
reverseReverse the stringaBcDDcBa
base64Encode the string to base64aBcDYUJjRA==
hexEncode the string to hexaBcD61426344
stringConvert the value to stringaBcDaBcD

number modifiers

ModifierDescriptionExample
commaAdd commas to the number10001,000
hexEncode the number to hex10003E8
octalEncode the number to octal10001750
binaryEncode the number to binary10001111101000
bytesConvert the number to bytes10001 KB
stringConvert the value to string10001000

date modifiers

ModifierDescriptionExample
localeFormat the date to the locale provided or system default9/22/20249/22/2024, 12:00:00 AM
timeFormat the date to the time provided9/22/202412:00:00 AM
dateFormat the date to the date provided9/22/20249/22/2024
unixConvert the date to a Unix timestamp9/22/20241692819200000
isoConvert the date to an ISO string9/22/20242024-09-22T00:00:00.000Z
utcConvert the date to UTC time9/22/20242024-09-22T00:00:00.000Z
yearGet the year from the date9/22/20242024
monthGet the month from the date9/22/20249
dayGet the day from the date9/22/202422
hourGet the hour from the date9/22/20240
minuteGet the minute from the date9/22/20240
secondGet the second from the date9/22/20240
stringConvert the value to string9/22/20249/22/2024
ampmGet the am/pm from the date9/22/2024 12:00:00 amam
AMPMGet the AM/PM from the date9/22/2024 12:00:00 amAM

Locale/Timezone Modifiers

Zipline lets you specify the locale and timezone for the locale, time, and date modifiers. To achieve this you need to specify the 2nd modifier: {user.createdAt::locale::en-UK,Europe/London}.

For example using {user.createdAt::locale::ja-JP,Asia/Tokyo} will format the date to the Japanese locale and timezone and will yield a result of 2024/9/22 19:30:00 when the system time is 9/22/2024 11:30 AM in the America/Los_Angeles timezone.

It is also possible to continue using the system locale, but specify a different timezone. To do this just specify the timezone: {user.createdAt::locale::,Europe/London}. Notice the comma is right after the double colons.

Some specific use cases for this may be if you want to use 24-hour time but continue using an American timezone, you can use {user.createdAt::locale::en-UK,America/Los_Angeles}. This will format the date and time to use 24-hour time and dd/mm/yyyy format instead of the default mm/dd/yyyy format used in the US.

Useful Info

If you are looking for a list of possible locales, you can visit https://www.unicode.org/cldr/charts/44/supplemental/language_territory_information.html. To use this table, take the language code ("Code" in the table) and the territory code ("Territory" in the table) and combine them with a hyphen. For example, the code for English in the United Kingdom is en-UK, and the code for Japanese in Japan is ja-JP.

A list of timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. Use the value under the "TZ identifier" column.

All values are case insensitive, so en-UK is the same as EN-uk and en-uk. The same goes for timezones: America/Los_Angeles is the same as america/los_angeles and AMERICA/LOS_ANGELES.

Conditional modifiers

To use conditional modifiers, you need to add them after the variable with a double colon ::, like normal modifiers but with a different format: {variableName.property::conditionalModifier["trueString"||"falseString"]}.

For example, to show the file's views if it has max views, you would use {file.maxViews::>0["{file.views}/{file.maxViews}"||"No max views"]}. This will show the views and max views if the max views are greater than 0, otherwise it will show "No max views".

ModifierDescriptionTypesVariables
istrueIf the boolean is truebooleanNone
existsWhether the element existsstring, dateNone
$XIf the string starts with XstringX = string
^XIf the string ends with XstringX = string
~XIf the string includes XstringX = string
=XIf the value equals to Xstring, numberX = string or number
>=XIf the number is greater or equal to XnumberX = number
>XIf the number is greater than XnumberX = number
<=XIf the number is lesser or equal to XnumberX = number
<XIf the number is lesser than XnumberX = number

Playground

Try out the variables below to see how they work. For dates, the time is when the page was loaded.

Note: Result may not be accurate.