Automation rules can be expressed using a simple yet powerful language referred to as BLANG.
This article describes the data types, variables and operators that make up this micro language, specifying how automation rules are evaluated for each incoming item.
A String represents a piece of text in between double quote characters.
Example: "This is just a piece of text"
An Integer represents a numerical value with no fractional component.
Example: 10012
Boolean is a data type that can have either of two values: true or false.
Example: true
Regular expressions can be used everywhere a String value is expected. They can also be a part of an array.
Example: /[a-z]*/
The regexp also supports flags, so you can write: /[a-z]*/i to ignore case.
BLANG regular expressions are expressed and operate in the same way as Javascript regular expressions. For more information, see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
Expressions can make use of read-only variables that are dynamically computed for each incoming item. Variables start with the $ character, followed by the variable name.
The following section describes all the variables that are currently available.
The following variables correspond to the information provided as API input.
Variable |
Description |
Data type |
Example |
---|---|---|---|
$title |
Heading of an item |
String |
"For sale" |
$body |
Text body of an item |
String |
"It is really nice" |
$text ($title + $body) |
Concatenation of the heading and the text body of an item |
String |
"For sale, It is really nice |
$email |
First email address of the user posting the item |
String |
"test@besedo.com" |
$phoneNumber |
First phone number of the user posting the item |
String |
"08-123 123 33" |
$categoryName |
Category name of the item |
String |
"Cars" |
$categoryId |
Category ID of the item |
String |
"cars", "vehicles-cars" or "22" |
$price |
Price of the item |
Integer |
1400 |
$currency |
ISO 4217 currency code |
String |
"SEK" |
$type |
Type of the item |
String |
"buy", "sell" or "rent" |
$userId |
Id of the user posting the item |
String |
"fjuki97" |
$userName |
Username of the user posting the item |
String |
"Fjodor Kiriakos" |
$city |
City name |
String |
"Stockholm" |
$postalCode |
Postal (zip) code |
String |
"12346" |
$region |
Region |
String |
"California" |
$countryCode |
Two-letter country code (ISO 3166-1 alpha-2) |
String |
"SE" |
$ip |
IP address of the user posting the ad. |
String |
"123.45.67.89" |
$status |
Status of the item in your system |
String |
"published" |
The following variables allow you to leverage the built-in automatic geolocation of end users in your automation rules.
See How to locate end users using geolocation to learn more about geolocation and how to make use of it.
Variable |
Description |
Data type |
Example |
---|---|---|---|
$geoCity |
Name of the city (in English) associated with the user's geolocation at the time of posting |
String |
"Stockholm" |
$geoContinent |
Name of the continent (in English) associated with the user's geolocation at the time of posting |
String |
"Europe" |
$geoCountry |
Name of the country (in English) associated with the user's geolocation at the time of posting |
String |
"Sweden" |
$geoCountryCode |
Country code (ISO 3166-1 alpha-2) associated with the user's geolocation at the time of posting |
String |
"SE" |
$geoPostalCode |
Postal code associated with the user's geolocation at the time of posting |
String |
"117 43" |
The following variable allows you to leverage the built-in duplicate detection capabilities of Implio in your automation rules.
See How to detect and moderate duplicate items to learn more about duplicate detection and how to make use of it.
Variable |
Description |
Data type |
Example |
---|---|---|---|
$numberOfDuplicates |
Number of exact text duplicates found for a given item in Implio |
Integer |
3 |
Implio comes with a number of built-in Text Vision filters that allow you to make sense of user-generated text (combination of an item's title and body), and make it actionable through automation rules.
Language detection
The following variables allow you to leverage the built-in automatic language detection in your automation rules.
See How to check the language in which users write to learn more about automation language detection and how to make use of it.
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.languageDetected |
Language in which the text is written (automatically detected) |
String |
ISO 639-1 code of the language in which text was detected to be written (e.g. "fr"), or "unknown" if no language could be detected. |
$text.languageExpected |
Value of the content.languageExpected API input field |
String |
ISO-639-1 code of the language in which the text is expected to be written, or <undefined> if no value was specified in the API input field. |
Nonsense
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.isNonsense |
Indicates whether the text is nonsensical:
|
String |
|
Toxic language
The following variables allow you to leverage toxic language detection in your automation rules.
See How to detect toxic language using Text Vision for more information on how to best use these.
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.blasphemyCount |
Number of blasphemy terms detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
$text.badWordCount |
Number of bad words detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
$text.sexualTermCount |
Number of sexual terms detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
$text.violenceTermCount |
Number of terms related to violence detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
$text.extremismTermCount |
Number of terms related to extremism detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
$text.racismTermCount |
Number of terms related to racism detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
$text.toxicTermCount |
Total number of toxic terms detected in the text (sum of all previously-listed toxic term counts) |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
Weapons
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.weaponTermCount |
Number of terms related to weapons detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
Pharmaceutical products
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.pharmaceuticalTermCount |
Number of pharmaceutical terms (products, companies, substances or general vocabulary) detected in the text |
Integer |
Number of terms detected, 0 if no term matched or if the language isn't supported |
Contact details
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.hasUrl |
Indicates whether the text contains a URL. |
String |
|
$text.hasEmail |
Indicates whether the text contains an email address. |
String |
|
$text.hasPhoneNumber |
Indicates whether the text contains a phone number. |
String |
|
$text.hasSocialMediaId |
Indicates whether the text contains a social media identifier. |
String |
|
$text.hasFullName |
Indicates whether the text has any mention of a full name. |
String |
|
$text.hasContactInfo |
Indicates whether the text contains some other form of contact information. |
String |
|
$text.hasContactRequest |
Indicates whether the author asks other users for their contact information. |
String |
|
Underage
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.underage14 |
Indicates whether the author mentions he/she is younger than 14, or seeks someone under that age. |
String |
|
$text.underage15 |
Indicates whether the author mentions he/she is younger than 15, or seeks someone under that age. |
String |
|
$text.underage16 |
Indicates whether the author mentions he/she is younger than 16, or seeks someone under that age. |
String |
|
$text.underage17 |
Indicates whether the author mentions he/she is younger than 17, or seeks someone under that age. |
String |
|
$text.underage18 |
Indicates whether the author mentions he/she is younger than 18, or seeks someone under that age. |
String |
|
$text.underage19 |
Indicates whether the author mentions he/she is younger than 19, or seeks someone under that age. |
String |
|
$text.underage20 |
Indicates whether the author mentions he/she is younger than 20, or seeks someone under that age. |
String |
|
$text.underage21 |
Indicates whether the author mentions he/she is younger than 21, or seeks someone under that age. |
String |
|
Gender detection
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.gender |
Gender of the author, as stated by the author |
String |
|
$text.genderSeek |
Gender sought by the author, as stated by the author |
String |
|
Relationship status
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.inARelationship |
Indicates whether the author mentions that he/she is in a relationship. |
String |
|
$text.seekingCasualRelationship |
Indicates whether the author mentions he/she is seeking a casual relationship. |
String |
|
Subscription info
Variable |
Description |
Data type |
Possible values |
---|---|---|---|
$text.hasSubscriptionInfo |
Indicates whether the author refers to his/her subscription or member status on the service. |
String |
|
In addition to the built-in variables listed above, it is also possible to send in custom parameters. A custom parameter must be prefixed with $$ to avoid naming collisions with present and future built-in variables.
Examples:
Operator |
Description |
Data type(s) |
Example |
---|---|---|---|
< |
Less than |
Integer |
$price < 1000 |
<= |
Less than or equals |
Integer |
$price <= 1000 |
> |
Greater than |
Integer |
$price > 1000 |
>= |
Greater than or equals |
Integer |
$price >= 1000 |
BETWEEN x - y |
Range of integers |
Integer |
$price BETWEEN 0 - 1000 |
NOT BETWEEN |
Range of integers |
Integer |
$price NOT BETWEEN 0 - 1000 |
EQUALS |
The parameter is an exact match of the value. If the value is a list of values, then it checks if any of the values match |
String, Integer, Boolean |
$categoryName EQUALS "Cars" $type EQUALS ("sell","buy") |
NOT EQUALS |
The parameter is not an exact match of the value. If the value is a list of values, then it checks so none of the values match |
String, Integer, Boolean |
$categoryName NOT EQUALS "Cars" $type NOT EQUALS ("sell","buy") |
CONTAINS |
Checks so the parameter contains the value. I.e. if a word is part of the text. If the value is a list it will check so any of the keywords match. |
String, Regular Expression |
$title CONTAINS "Snus" $title CONTAINS("tobacco","cigarettes","vape") $userId CONTAINS @whitelistedUsers |
NOT CONTAINS |
Checks so the parameter does not contain the value. I.e. if a word is part of the text. If the value is a list it will check so none of the keywords match. |
String, Regular Expression |
$title NOT CONTAINS "Certified" $title NOT CONTAINS ("CE","Certificate","Conform") $ip NOT CONTAINS @blacklistedIPs |
Word boundaries are respected for Strings, but not for Regular Expressions.
Examples
Considering $text equals "Hello friend how are you?", this is how the following expressions will be evaluated:
Expression |
Result |
---|---|
$text CONTAINS "friend" |
Match |
$text CONTAINS "fri" |
No match |
$text CONTAINS /fri/ |
Match |
String matches ignore case but Regular Expressions are case sensitive, unless the /i flag is specified.
Examples
Considering $text equals "Hello friend how are you?", this is how the following expressions will be evaluated:
Expression |
Result |
---|---|
$text CONTAINS "hello" |
Match |
$text CONTAINS "HELLO" |
Match |
$text CONTAINS /hello/ |
No match |
$text CONTAINS /hello/i |
Match |
Expressions can be combined using AND and OR expressions. Also, the evaluation order can be prioritized using parentheses ( ):
By default, AND has a higher priority than OR. This mean that a OR b AND c will be evaluated as a OR (b AND c)
Expressions can also be negated using NOT.
Examples
Instead of comparing a parameter against one value and creating long expressions you can use arrays to compare a parameter against a couple of Strings, integers or regular expressions. If you have more than just a few, you can include them in a list and include the list in your filter. The table below illustrates the difference between each method of writing an expression, their result is equivalent.
Comparison with one value |
Equivalent using arrays |
Equivalent using lists |
---|---|---|
$title CONTAINS "citroen" OR $title CONTAINS "saab" OR $title CONTAINS "dacia" |
$title CONTAINS ("citroen", "saab", "dacia") |
$title CONTAINS @car_models |
$userId EQUALS 382971232 OR $userId EQUALS 223133740 |
$userId EQUALS (382971232, 223133740) |
$userId EQUALS @bad_users |
$text CONTAINS /dog(s)?/ OR $text CONTAINS "cat" OR $text CONTAINS /[a-z]*-animal/ |
$text CONTAINS (/dog(s)?/, "cat", /[a-z]*-animal/) |
$text CONTAINS @animal_list |
You can easily compare two variables together by putting one on each side of the EQUALS operator.
Examples
We are here to support you.