Expressions
An expression is a block you drop into a text input that gets replaced with real information when your feature runs.
You write it once. It comes out different every time, because it's filled in from whatever just happened.
Expressions are built from two things: values and functions.

Values - the basic case
Here's the example that makes it obvious.
You want to reply to whoever sent a message and @mention them.
You add a Reply action and start typing: Hello, … and then you're stuck. You can't type the @mention, because it's a different person every time. There's nothing to type.

That's what an expression is for.
Instead of typing a name, you insert the value user → mention.

Your reply now reads:

When the feature runs, user→mention is swapped out for a real @mention of whoever actually sent the message. One reply action, correct for everybody.
Values come from the parameters you already know (Events and Parameters Page): the message's content, the server's name, the channel, the member's nickname, your own account. Anything listed under a parameter can go into an expression.
You can mix plain text and values freely.
Functions - doing something to a value
A value gives you information exactly as it is. A function changes it, or works something out from it.
Every function has:
a name - what job it does
one or more inputs - what it works on
a result - what comes back
The simplest example is upper, which makes text capital letters:
You select:

You get: HELLO
On its own that's useless - you already knew it said "hello." Functions become useful when you put a value inside them.
By selecting:

You get: JOHNSMITH (whatever the users' name is).
Now it works on whoever triggered the event.
Functions can go inside functions
The result of one function can be the input to another. That's where real power comes from.
Say you want someone's nickname, but not everyone has one, and you want it in capitals:

Read it from the inside out, like a set of nesting boxes. The innermost thing is worked out first, and each layer wraps around the result.
Things worth knowing
Everything becomes text when combined. When you mix values, functions and typed text into one field, the result is a single piece of text. A number used in a message comes out as text - that's fine and expected.
Files are a special case. Some values aren't text at all - a user's avatar, a message's attachments. When you put one of those into a field on its own, it's handed over as a real file. They are meant to be used in special File inputs.
Last updated