Invitations with Regular Expressions
This section helps you understand how you can use regular expressions together with Custom Variables and Auto-Invite Rulesets to trigger invitations based on an almost inexhaustible set of values.
In essence, regular expressions (regex) are used to determine if characters, words or even a pattern of characters exist within a given string. By using Regular Expressions together with BoldChat’s Custom Variables and the Advanced Custom Field Rules (within an auto-invite rule), you gain the ability to check for an almost limitless number of data points that can form the basis of your rule criteria.
These values can be derived from HTML page elements or custom values by passing and concatenating multiple comma separated values into a single custom variable. Rules can then be set to look for multiple values within the variable text string and fire off an invitation based on the results.
Setting up the variables
The div tags below represent page elements of interest, of which you want to use as a basis for your rule criteria.
The next example shows Visitor Monitoring HTML; you will need to edit it slightly in order to pass the div element values into BoldChat’s custom variables.
Here the VisitRef custom variable is set to contain a string value of Item Number = 123456789, Invoice Total = $20.00, Availability = 24, Product Name = Widget:
pageViewer.setParameter("VisitRef", "Item Number =" + itemNum + "," + "Invoice Total =" + invoiceTot + "," + "Availablity = " + avail + "," + "Product Name =" + productName);
Take note that both the Visit Ref Contains and the Match Contains Rules using Regular Expressions are checked and the Visit Ref Contains field has a value of Item Number = 123456789. Availability = 24.
The .* operator is used to check if the Visit Ref Contains field has the values listed before and after the operator in that order. The value sequence is important. For instance; currently the VisitRef variable contains the string value of Item Number = 123456789, Invoice Total = $20.00, Availability = 24, Product Name = Widget. The regular expression operator checks to see if Item Number = 123456789 is contained in the variable. If so, it looks for a value of Availability = 24. The query equates true and an invitation is sent.