SmsPort Docs / WhatsApp

Expression Examples

Common expression recipes for bot runtime calculations.

Lead Scoring

Set a lead tier based on numeric score.

Functions used:ifgte

expression
if(gte({{score}}, 85), "A", if(gte({{score}}, 70), "B", "C"))

Fee Calculation

Add registration charge to base fee.

Functions used:add

expression
add({{base_fee}}, {{registration_fee}})

Follow-up Date

Set next follow-up date to tomorrow.

Functions used:date_add_daystoday

expression
date_add_days(today(), 1)

Date Age Check

Check how many days since lead creation date.

Functions used:date_diff_daystoday

expression
date_diff_days(today(), {{lead_created_on}})

Weekday Routing

Tag conversation based on day of week.

Functions used:day_of_weekifeq

expression
if(eq(day_of_week(today()), "sunday"), "weekend", "weekday")

Date Format Output

Format timestamp into a readable date string.

Functions used:date_formatnow

expression
date_format(now(), "DD/MM/YYYY")

Shift Reminder by Hours

Set reminder timestamp 2 hours after current time.

Functions used:date_add_hoursnow

expression
date_add_hours(now(), 2)

Weekly Window

Get current week start and end dates.

Functions used:start_of_weekend_of_weektoday

expression
start_of_week(today())
end_of_week(today())

Timezone Display

Convert UTC timestamp into target timezone display value.

Functions used:timezone_convertnow

expression
timezone_convert(now(), "Asia/Kolkata")

Display Name Formatting

Combine first and last name safely.

Functions used:trimconcat

expression
trim(concat({{first_name}}, " ", {{last_name}}))