Skip to navigation

Variables and addressing the recipient

How to put the recipient's name, username, sender details and a link from a list into a message

A variable in curly braces is replaced with real data when the message is sent: write {first_name}, and each recipient sees their own name. It works in text messages of DM spammer. Chat spammer and Reporter have no recipient, so variables aren’t filled in there.

Variable list

Insert them through the Variables menu above the message field, or type them by hand.

VariableWhat it becomesExample
{first_name}Recipient’s first namePavel
{last_name}Recipient’s last nameDurov
{name}First and last namePavel Durov
{username}Recipient’s username, with ”@“@durov
{my_first_name}, {my_last_name}, {my_name}, {my_username}The same for the sending accountAnna Smirnova
{link}The next link from the message’s listhttps://t.me/my_channel

The list for {link} is filled in under Text and files. Variables work inside spintax, bold text and a link address:

{Hi|Hello}, {name:colleague}. Here's the selection: [our channel]({link})

Fallback text

An empty variable turns into an empty spot: “Hi, !”. Set fallback text after a colon:

Hi, {first_name:friend}!

It’s inserted as is, without markup or spintax, and it must not contain curly braces. The fields most often empty are {last_name} and {username}: for recipients imported from the parser without a username, {username} is always empty.

Preview

The preview has Test values: enter some data, and the message is shown with it.

Tips

  • Add fallback text when a variable starts a phrase: {first_name:Good afternoon}.
  • A typo like {fist_name} is sent to the recipient as is, with the braces.
  • {link} in the text with an empty link list: the campaign won’t start.
  • Braces as characters: \{ and \}.
  • [name], [link] and the others in square brackets work too, but without fallback text.
  • Telegram’s limit is 4096 characters, 1024 for a file caption. If a long name doesn’t fit into any text variant, the recipient is skipped.