Skip to main content

Powered By Text Mapping Functions

Reference for the Powered By Text-specific functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The Powered By Text integration provides two ready-made functions you can call when building mappings. They handle the mobile number, the value Powered By Text keys every subscriber by, so you don't have to write that logic yourself. LookupPhoneNumber takes the mobile number from a field you name, because iPaaS.com customers have no phone field of their own and organizations keep mobile numbers in different places. PoweredByTextMobileNumber turns a phone number written any common way into the form Powered By Text uses: digits only, with the country calling code first. The default mapping collections use neither function. You need them only when your mobile numbers are not on an address phone, or when you write your own filter or formula.

Where you can use these functions

These functions are available anywhere you write a formula for the Powered By Text 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: PoweredByTextMobileNumber(a.PhoneNumber, "US") inside a condition on a customer's addresses.

  • 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.

  • These functions are synchronous, so you call them directly (no await is required).

  • Each function runs at sync time, against the record being transferred and your iPaaS.com subscription. Neither function calls your Powered By Text account.

The functions are grouped below by the area of the integration they support.

Mobile Numbers

Use these in collections that send subscribers and thank-you texts FROM iPaaS.com, where the mobile number decides who joins the Powered By Text group or receives the text.

LookupPhoneNumber

What it does: Uses the phone number held in the field you name as the mobile number to subscribe or text. The formula returns an instruction rather than the number: the integration reads the named field when it sends the record, first on the record being sent and, only when that record doesn't carry the field, on the linked iPaaS.com customer (read once).

Signature: string LookupPhoneNumber(string fieldName)

How to call it: LookupPhoneNumber(fieldName)

Parameter

Type

Required

Default

Description

fieldName

string

Yes

N/A

The iPaaS.com field that holds the mobile number: an iPaaS.com customer custom field's exact name (any capitalization, for example "Mobile Phone"), or a standard field's name. In a standard field's name, capitalization, spaces, dots, underscores and dashes don't matter: "Phone Number", "PhoneNumber" and "Addresses.PhoneNumber" all mean the address phone. Pass "" for the default: the Powered By Text Mobile Number custom field, else the address phone.

Returns: string. An instruction the integration resolves when it sends the record, not the number itself. The integration replaces it with the number it finds, then reads that number with the Mobile Country Code setting like any mapped number. When the field is blank or missing on both the record and the linked iPaaS.com customer, the transfer fails with an error that names the function and the field, for example LookupPhoneNumber("Cell") found no phone number, and nothing is sent. Two cases don't fail, because the number is already settled: an update of a customer already linked to a Powered By Text number keeps the linked number, and an address Phone lookup that finds nothing is left blank when MobileNumber already has a number.

Example: In a MobileNumber Dynamic Formula mapping, return LookupPhoneNumber("Mobile Phone"); sends the number held in the customer's Mobile Phone custom field.

When to use it: When your organization keeps mobile numbers somewhere other than the customer's address phone, such as a custom field. Map it as the whole formula of one of these mappings, in collections FROM iPaaS.com only:

  • MobileNumber in Add/Update Powered By Text Subscriber FROM iPaaS.com.

  • Phone in Add/Update Powered By Text Subscriber Address FROM iPaaS.com.

  • MobileNumber in Add Powered By Text Thank-you Text FROM iPaaS.com.

Anywhere else the instruction is never replaced by a number, so don't compare its result or join it with other text. Things to know:

  • Search order: a custom field of the name comes before a standard field of the same name, so LookupPhoneNumber("Phone Number") reads a custom field called Phone Number when one has a value, else the address phone. On the iPaaS.com customer, the address phone is taken from the primary billing address first, then the other addresses.

  • The linked customer: for a subscriber, the customer is the one in the CustomerId mapping, which the default template includes. A thank-you text carries no custom fields or addresses of its own (the function can't read the transaction's addresses), so the integration reads the buyer's iPaaS.com customer through that collection's CustomerId mapping. No iPaaS.com read is made when the record being sent carries the field.

  • Customers already linked: when an update of a customer already linked to a Powered By Text number finds nothing in the field, the linked number is kept. A number found that differs from the linked one is refused, because Powered By Text keys subscribers by number.

  • Keep the filter in step: the default Add/Update Powered By Text Subscriber FROM iPaaS.com filter sends only customers with an address phone. When your numbers are in a custom field instead, change the filter's phone condition to check that field, for example !string.IsNullOrWhiteSpace(Convert.ToString(GetCustomFieldValue(CustomFields, "Mobile Phone"))).

Validate a new mapping in a staging subscription before relying on it in production, using phone numbers you own: the Powered By Text sandbox and production both send real texts to real phones.

PoweredByTextMobileNumber

What it does: Returns a phone number in the form Powered By Text keys subscribers by: digits only, with the country calling code first. Returns an empty string when the text isn't a number it can read. It applies the same rule the integration uses when it adds, links and texts a number.

Signature: string PoweredByTextMobileNumber(string phone, string countryCode)

How to call it: PoweredByTextMobileNumber(phone, countryCode)

Parameter

Type

Required

Default

Description

phone

string

Yes

N/A

The phone number to read, usually an iPaaS.com customer address's PhoneNumber, in any common format: spaces, brackets, dots and dashes are ignored. A number starting with + or 00 is read as already carrying its country calling code.

countryCode

string

Yes

N/A

The two-letter country of a number written without a country calling code: US, CA, PR, GB or AU (any capitalization; surrounding spaces are ignored). Pass "" to use US. Pass the same value as the subscription's Mobile Country Code setting so the result matches the number the integration uses: the function does not read the setting itself.

Returns: string. The digits with the country calling code first, or an empty string when the number can't be read. The number is read this way:

  • A number of the country's national length gets the calling code in front: 10 digits for US, CA, PR and GB, 9 for AU.

  • A national number written with a leading 0 (one digit longer) loses the 0 and gets the calling code.

  • A number that already starts with the country's calling code and has the full length is kept as it is.

  • A number starting with + or 00 keeps its own calling code when it has 8 to 15 digits.

The result is an empty string when phone is blank or holds no digits, when the number has too few or too many digits for the country, or when countryCode is not one of the five countries above and the number doesn't start with + or 00. The integration refuses such a number when it sends the record, with an error that it can't be read as a mobile number for the Mobile Country Code setting.

Example: PoweredByTextMobileNumber("(555) 123-4567", "US") returns "15551234567". PoweredByTextMobileNumber("020 7946 0018", "GB") returns "442079460018", and PoweredByTextMobileNumber("555-0142", "US") returns "" (too few digits).

When to use it: In a filter, to keep out records with no phone the integration can read as a mobile number, so they are skipped instead of failing. For example, in the phone condition of the Add/Update Powered By Text Subscriber FROM iPaaS.com filter, replace !string.IsNullOrWhiteSpace(a.PhoneNumber) with PoweredByTextMobileNumber(a.PhoneNumber, "US") != "", keep the consent condition as it is, and use your own Mobile Country Code in place of "US". That filter passes a customer when any address phone can be read, while the integration uses the first address phone when no MobileNumber is mapped, so a customer whose first address phone can't be read still fails. In a formula, to compare a customer's phone with the number in the Powered By Text Mobile Number custom field, which holds the number in this same form. To test for an unreadable number, compare the result with "".

Related Documents

Did this answer your question?