Overview
The Slack V2 integration provides a set of ready-made functions you can call when building mappings. They build well-formatted Slack messages from your iPaaS.com data (error alerts, labeled lines, money amounts, links and mentions), turn any text into a valid Slack channel name, and look up a member of your Slack workspace by name, so you don't have to build that logic yourself.
Where you can use these functions
These functions are available anywhere you write a formula for the Slack V2 integration:
Dynamic Formula mappings: where a destination field's value is produced by a formula rather than mapped directly from a source field.
Mapping collection filters: where a formula decides whether a record should be processed.
Error filters: a mapping collection's error filter, which sits alongside its collection filter. When the error filter's formula resolves to true, the transfer raises an error that is held in the Error Logs for review and is not retried automatically.
Translation collections: where a translation entry uses a formula as its source value.
How to use them
Call a function by name and pass the values it needs in parentheses, for example:
Field("Total", Money(Total, "$")).Each function's signature shows its name, the parameters it accepts (with their types), and the type of value it returns. Use it as the reference for exactly how to call the function.
Function names and formula syntax are case-sensitive, so type each name exactly as shown. Whether the values a function matches are treated as case-sensitive varies by function, and is called out in the relevant parameter's description.
Some of these functions are asynchronous (their signature returns a
Task) and must be called withawait; the rest are synchronous and are called directly. Each function's How to call it example shows the correct form.Each function runs at sync time, against the data in your connected Slack workspace and your iPaaS.com subscription.
The functions are grouped below by the area of the integration they support.
Error Alert Messages
Use these in the Text mapping of the Add/Update Slack Error Alert Message FROM iPaaS.com collection, which posts iPaaS.com transfer errors to Slack.
StandardMessage
What it does: Builds a standard Slack alert from an iPaaS.com error message: a bold headline, a line of detail fields, the error details, and a line of action links. It keeps the alert within about 3,700 characters and removes characters that can break Slack formatting.
Signature: string StandardMessage(string text, string details, Dictionary<string, string> detailFields, Dictionary<string, string> links)
How to call it: StandardMessage(text, details, detailFields, links)
Parameter | Type | Required | Default | Description |
text |
| Yes | N/A | The alert headline from the iPaaS.com message, shown in bold between two |
details |
| Yes | N/A | The error details from the iPaaS.com message. When the whole alert would be longer than about 3,700 characters, HTML tags, line breaks, backslashes and repeated spaces are removed from the details, and the details are then cut to fit. An empty value posts the alert without details. |
detailFields |
| Yes | N/A | The detail fields of the iPaaS.com message. The keys |
links |
| Yes | N/A | The action links of the iPaaS.com message. The keys |
Returns: string. The alert text, ready to post. In the headline, the detail fields and the details, curly braces ({ and }) are removed and backslashes are replaced with a vertical bar (|). Forward slashes are kept, so web addresses in the error text, such as the help-article link at the end of each error, open as sent. The action links are added after this step and are not changed.
Example: StandardMessage("Error processing order", "Stacktrace and details...", detailFields, links) returns an alert that starts with the bold headline Error processing order, then shows the Scope and External Id values, the details, and the Retry and Detail links supplied in links.
When to use it: Use it in the error alert's Text mapping so every alert has the same readable layout. The default template trims the details first and then calls the function: if (Details != null && Details.Length > 3500) Details = Details.Substring(0, 3500); return StandardMessage(Text, Details, DetailFields, Links);. The headline, the detail fields and the links are never shortened: when they alone are longer than about 3,700 characters, the transfer stops with an error in Dashboard / Integration Monitoring / Error Logs.
StandardMessage_DetailFields
What it does: Builds the line of detail fields that follows the headline of a StandardMessage alert: the scope, external id and system id of the iPaaS.com message, each with a bold label.
Signature: string StandardMessage_DetailFields(Dictionary<string, string> detailFields)
How to call it: StandardMessage_DetailFields(detailFields)
Parameter | Type | Required | Default | Description |
detailFields |
| Yes | N/A | The detail fields of the iPaaS.com message. The keys |
Returns: string. The labelled values followed by a line break, or an empty string when detailFields has no value. Curly braces ({ and }) are removed and backslashes are replaced with a vertical bar (|).
Example: A detailFields value with Scope set to customer/created and ExternalId set to 1234 returns *Scope*: customer/created *External Id*: 1234 and a line break, which Slack shows with Scope and External Id in bold.
When to use it: StandardMessage already adds this line. Use it only when you build your own alert layout and want the same detail line under your headline.
StandardMessage_Links
What it does: Builds the line of action links that ends a StandardMessage alert: each link shows a label (Retry, Debug, Detail or Dismiss) with an emoji instead of the full address.
Signature: string StandardMessage_Links(Dictionary<string, string> links)
How to call it: StandardMessage_Links(links)
Parameter | Type | Required | Default | Description |
links |
| Yes | N/A | The action links of the iPaaS.com message. The keys |
Returns: string. A line break followed by the links, separated by spaces, or an empty string when links has no value or holds none of these keys.
Example: A links value with Retry and Debug addresses returns a line such as :repeat: <https://...|Retry> :computer: <https://...|Debug>, which Slack shows as the clickable labels Retry and Debug.
When to use it: StandardMessage already adds this line. Use it only when you build your own alert layout and want the same action links at the end.
StripTagsCharArray
What it does: Removes HTML tags from text and returns only the visible text. Everything from a < to the next > is dropped.
Signature: string StripTagsCharArray(string source)
How to call it: StripTagsCharArray(source)
Parameter | Type | Required | Default | Description |
source |
| Yes | N/A | Text from an iPaaS.com record that may contain HTML markup, for example error details or a product description. It must have a value: a field with no value at all stops the transfer with an error in Dashboard / Integration Monitoring / Error Logs. Empty text is returned unchanged. |
Returns: string. The text without its HTML tags. A < that is not part of a tag also removes the text after it up to the next > (or to the end), so 5 < 10 returns only 5 and the space after it.
Example: "<p>Hello <strong>World</strong></p>" returns "Hello World".
When to use it: StandardMessage already removes tags from long details. Use it to clean HTML out of other record text before you add it to a message. When the field can have no value, check it first, for example: string.IsNullOrEmpty(Description) ? "" : StripTagsCharArray(Description).
Message Text
Use these in the Text mapping of any collection to build the lines of a notification. The default Large Sale, New Customer, New Product and Low Inventory templates build their messages this way.
Field
What it does: Formats one labeled value as a line of a Slack message, with the label in bold. Returns nothing when the value is empty, so records without that value don't show an empty line.
Signature: string Field(string label, object value)
How to call it: Field(label, value)
Parameter | Type | Required | Default | Description |
label |
| Yes | N/A | The label shown in bold, for example |
value |
| Yes | N/A | The iPaaS.com value to show: text, a number or a formatted amount. An empty value, or a value made only of spaces, leaves the line out. A zero is shown. |
Returns: string. The line *label:* value followed by a line break, which Slack shows with the label in bold, or an empty string when the value is empty. The label and the value are escaped for Slack (&, < and >), so they show as typed.
Example: Field("Customer", FirstName + " " + LastName) + Field("Email", EmailAddress) returns *Customer:* Jane Doe and *Email:* jane@example.com on two lines.
When to use it: Use it for each detail line of a notification, for example the default New Customer template: return ":wave: *New customer*" + (string.IsNullOrEmpty(Company) ? "" : " :office: B2B") + "\n" + Field("Name", FirstName + " " + LastName) + Field("Company", Company) + Field("Email", EmailAddress) + Field("Customer number", CustomerNumber);.
Money
What it does: Formats an amount with a currency symbol, thousands separators and two decimals.
Signature: string Money(object amount, string currencySymbol)
How to call it: Money(amount, currencySymbol)
Parameter | Type | Required | Default | Description |
amount |
| Yes | N/A | The iPaaS.com amount, for example |
currencySymbol |
| Yes | N/A | The symbol to put in front of the amount, for example |
Returns: string. The formatted amount; an empty string when the amount is empty; the text itself when it is not a number. Negative amounts (refunds) keep their sign in front of the symbol: -$40.00.
Example: Money(Total, "$") shows a Total of 12500.5 as $12,500.50.
When to use it: Use it for totals, prices and balances, usually inside Field, as the default Large Sale template does: Field("Total", Money(Total, "$")). When the amount comes from a custom field or other text, a value that is not a number is posted as typed rather than formatted.
SlackLink
What it does: Builds a Slack link that shows a label instead of the full address.
Signature: string SlackLink(string url, string label)
How to call it: SlackLink(url, label)
Parameter | Type | Required | Default | Description |
url |
| Yes | N/A | The address to open, for example the record's page in iPaaS.com. When it is empty, no link is built. |
label |
| Yes | N/A | The text to show. When it is empty, the address itself is shown. A vertical bar in the label is shown as a broken bar ( |
Returns: string. Slack's link markup, <url|label>, with the label escaped for Slack. When the address is empty, it returns the escaped label alone, without a link.
Example: SlackLink("https://portal.ipaas.com/...", "Open order " + TransactionNumber) returns <https://portal.ipaas.com/...|Open order 10045>, which Slack shows as the clickable text Open order 10045.
When to use it: Use it to add a "view the record" link to a notification's Text.
SlackEscape
What it does: Escapes the three characters Slack treats as markup (&, < and >) so text from a record shows exactly as typed.
Signature: string SlackEscape(string text)
How to call it: SlackEscape(text)
Parameter | Type | Required | Default | Description |
text |
| Yes | N/A | Text from an iPaaS.com record, for example a product name or a customer comment. |
Returns: string. The text with &, < and > replaced by &, < and >, or an empty string when the text is empty.
Example: SlackEscape("Salt & Pepper <Large>") returns Salt & Pepper <Large>, which Slack shows as Salt & Pepper <Large>. Without escaping, Slack would read <Large> as a link or mention.
When to use it: Use it for record text you add to a message directly. Field and SlackLink already escape their text, so don't escape it twice.
Channels and Members
Use these in the Channel mapping to choose where a message goes, or in the Text mapping to mention a person.
ChannelName
What it does: Converts any text into a valid Slack channel name: lowercase letters, numbers, hyphens and underscores, at most 80 characters.
Signature: string ChannelName(string text)
How to call it: ChannelName(text)
Parameter | Type | Required | Default | Description |
text |
| Yes | N/A | The text to turn into a channel name, such as an iPaaS.com location, system or company name. A leading |
Returns: string. The channel name without a leading #: the text in lowercase, with spaces and punctuation (including accented letters) replaced by a single hyphen, no hyphen at the start or end, and cut to 80 characters. Returns an empty string when nothing usable is left.
Example: "store-" + ChannelName("Memphis Downtown #2") returns store-memphis-downtown-2.
When to use it: Use it in the Channel mapping to send each store, system or account to its own channel. The integration never creates channels: create each resulting channel in Slack before you turn the notification on, or the transfer stops with an error. A plain channel name typed in the Channel mapping is converted the same way automatically. A name of seven or more capital letters and digits that starts with C, D, G, U or W (for example WAREHOUSE) looks like a Slack id, so it is sent first as an id and, when Slack doesn't know it, once more as the channel name (#warehouse). Pass such names through this function (ChannelName("WAREHOUSE") returns warehouse) or start them with # to post on the first try.
UserIdFromName
What it does: Looks up a member of your Slack workspace by name and returns that member's Slack user ID. It matches the member's Slack username first, then the member's real name.
Signature: Task<string> UserIdFromName(string profileName)
How to call it: await UserIdFromName(profileName)
Parameter | Type | Required | Default | Description |
profileName |
| Yes | N/A | The Slack username or real name of the member, for example |
Returns: string. The Slack user ID of the member, for example U12345678, or null when no member matches.
Example: await UserIdFromName("john.doe") returns "U12345678".
When to use it: Use it in the Channel mapping to send a message directly to one person. The Channel mapping must be a Dynamic Formula, for example return await UserIdFromName("jane");. When no member matches, the Channel mapping returns nothing and the transfer stops with an error in Dashboard / Integration Monitoring / Error Logs. Keep these points in mind:
The lookup uses the first member that matches. When two members share a name, the message can reach the wrong person, so use the member's ID, or a channel, when names repeat.
The lookup checks every member Slack lists for the workspace, which includes deactivated members.
Each call reads the workspace member list from Slack in a single request, without asking for further pages. Slack documents that, without a page size, it tries to return the whole list and that large workspaces may require one, so in a very large workspace validate that the lookup finds the member before relying on it. When Slack limits the number of requests, the transfer is held and retried automatically.
MentionUser
What it does: Mentions a Slack member in a message, so they are notified. The member is found by Slack username or real name, or given by Slack user ID.
Signature: Task<string> MentionUser(string profileName)
How to call it: await MentionUser(profileName)
Parameter | Type | Required | Default | Description |
profileName |
| Yes | N/A | The member's Slack username or real name, for example |
Returns: string. Slack's mention markup, for example <@U12345678>, which Slack shows as @Jane Doe and which notifies the member. When no member matches, it returns @Jane Doe as plain text, which notifies no one. An empty value returns an empty string.
Example: var mention = await MentionUser("Jane Doe"); return mention + " a new B2B account needs review."; posts <@U12345678> a new B2B account needs review. Await the function on its own line first: written inside a longer expression, such as await MentionUser("Jane Doe") + " ...", the formula stops the transfer with an error.
When to use it: Use it in the Text mapping to call a person's attention to a message posted in a channel. Each call reads the workspace member list from Slack, so mention one or two people per message. If the mention shows as plain text, no member matched: check the Slack username or real name, or pass the member's ID. A name of seven or more capital letters and digits that starts with C, D, G, U or W (for example WAREHOUSE) is taken as a user ID and is not looked up, so write such names as they appear in Slack with lowercase letters.
