Skip to main content

Mailchimp Mapping Functions

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

Overview

The Mailchimp integration provides a set of ready-made functions you can call when building mappings. They handle common lookups and conversions for Mailchimp, such as resolving a Mailchimp product or customer from an iPaaS.com SKU, ID, or email, building a Mailchimp address, and formatting birthdays and date-times to the formats Mailchimp expects, so you don't have to write that logic yourself.

Where you can use these functions

These functions are available anywhere you write a formula for the Mailchimp 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: await GetProductIdBySku(Sku, StoreId).

  • 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 with await; the rest are synchronous and are called directly. Each function's How to call it example shows the correct form.

  • Optional parameters are marked in the parameter table, along with the value used when you omit them.

  • Each function runs at sync time, against the data in your connected Mailchimp account and your iPaaS.com subscription.

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

Products

Use these to resolve a Mailchimp product from an iPaaS.com SKU, or an iPaaS.com product name from its ID.

GetProductIdBySku

What it does: Finds a Mailchimp product ID (or variant ID) from an iPaaS.com product SKU within a Mailchimp store. It looks the product up directly first; if that does not match, it resolves the SKU through the variant mapping. Returns nothing if the SKU or store is missing, or no product or variant matches.

Signature: Task<string> GetProductIdBySku(string Sku, string StoreId, bool isVariant = false)

How to call it: await GetProductIdBySku(Sku, StoreId)

Parameter

Type

Required

Default

Description

Sku

string

Yes

N/A

The iPaaS.com product or variant SKU.

StoreId

string

Yes

N/A

The Mailchimp store ID where the product is located.

isVariant

bool

No

false

When true, returns the variant ID instead of the product ID.

Returns: string. The Mailchimp product ID (or variant ID when isVariant is true), or nothing if no match is found.

Example: await GetProductIdBySku("ABC-123", "store_1") returns the Mailchimp product ID for that SKU.

When to use it: When mapping a product or line to Mailchimp and you have the SKU but need the Mailchimp product or variant ID.

GetProductNameById

What it does: Returns the name of an iPaaS.com product for a given iPaaS.com product ID. Returns nothing if the ID is not valid or the product is not found.

Signature: Task<string> GetProductNameById(long Id)

How to call it: await GetProductNameById(Id)

Parameter

Type

Required

Default

Description

Id

long

Yes

N/A

The iPaaS.com product ID.

Returns: string. The iPaaS.com product name, or nothing if the product is not found.

Example: await GetProductNameById(1001) returns the name of that iPaaS.com product.

When to use it: When mapping product details to Mailchimp and you have the iPaaS.com product ID but need its name.

Customers

Use these to resolve a Mailchimp customer identifier from an iPaaS.com customer ID or email.

GetCustomerIdById

What it does: Finds a Mailchimp customer identifier from an iPaaS.com customer ID within a Mailchimp store. Returns nothing if the customer is not found in iPaaS.com or Mailchimp.

Signature: Task<string> GetCustomerIdById(long? customerId, string storeId)

How to call it: await GetCustomerIdById(customerId, storeId)

Parameter

Type

Required

Default

Description

customerId

long?

Yes

N/A

The iPaaS.com customer ID.

storeId

string

Yes

N/A

The Mailchimp store ID of the order.

Returns: string. The Mailchimp customer identifier, or nothing if the customer is not found.

Example: await GetCustomerIdById(12345, "store_1") returns the Mailchimp customer identifier for that customer.

When to use it: When mapping an order to Mailchimp and you have the iPaaS.com customer ID but need the Mailchimp customer identifier.

GetCustomerIdByEmail

What it does: Finds a Mailchimp customer identifier from an iPaaS.com customer email within a Mailchimp store. Returns nothing if no customer matches.

Signature: Task<string> GetCustomerIdByEmail(string email, string storeId)

How to call it: await GetCustomerIdByEmail(email, storeId)

Parameter

Type

Required

Default

Description

email

string

Yes

N/A

The iPaaS.com customer email.

storeId

string

Yes

N/A

The Mailchimp store ID of the order.

Returns: string. The Mailchimp customer identifier, or nothing if no customer matches.

Example: await GetCustomerIdByEmail("user@example.com", "store_1") returns the Mailchimp customer identifier for that email.

When to use it: When mapping an order to Mailchimp and you have the customer's email but need the Mailchimp customer identifier.

Addresses

Use this to convert an iPaaS.com address into the Mailchimp address model.

BuildAddress

What it does: Converts an iPaaS.com address into the address model Mailchimp expects, mapping fields such as company, street lines, city, region, postal code, country, and phone.

Signature: Address BuildAddress(object addressResponse)

How to call it: BuildAddress(addressResponse)

Parameter

Type

Required

Default

Description

addressResponse

object

Yes

N/A

The iPaaS.com address to convert.

Returns: Address. The Mailchimp address model built from the supplied iPaaS.com address.

Example: BuildAddress(addressResponse) returns the Mailchimp address model for the supplied address.

When to use it: When mapping an iPaaS.com address to a Mailchimp address field.

Dates

Use these to format birthdays and date-times to the formats Mailchimp expects.

FormatBirthdayMMDD

What it does: Formats a date as a Mailchimp birthday string in MM/dd format. Returns nothing if the input is empty. Raises an error if the value is not a valid date.

Signature: string FormatBirthdayMMDD(object input)

How to call it: FormatBirthdayMMDD(input)

Parameter

Type

Required

Default

Description

input

object

Yes

N/A

The date to format (a date/time value, or a string that can be parsed as a date).

Returns: string. The date formatted as MM/dd, or nothing if the input is empty.

Example: FormatBirthdayMMDD("1990-01-15") returns "01/15".

When to use it: When mapping a birthday to Mailchimp and it expects the MM/dd format.

FormatBirthdayDDMM

What it does: Formats a date as a Mailchimp birthday string in dd/MM format. Returns nothing if the input is empty. Raises an error if the value is not a valid date.

Signature: string FormatBirthdayDDMM(object input)

How to call it: FormatBirthdayDDMM(input)

Parameter

Type

Required

Default

Description

input

object

Yes

N/A

The date to format (a date/time value, or a string that can be parsed as a date).

Returns: string. The date formatted as dd/MM, or nothing if the input is empty.

Example: FormatBirthdayDDMM("1990-01-15") returns "15/01".

When to use it: When mapping a birthday to Mailchimp and it expects the dd/MM format.

ConvertToUtcFormat

What it does: Converts a date-time string that includes an offset into UTC, formatted as an ISO 8601 string ending in Z.

Signature: string ConvertToUtcFormat(string dateTimeWithOffset)

How to call it: ConvertToUtcFormat(dateTimeWithOffset)

Parameter

Type

Required

Default

Description

dateTimeWithOffset

string

Yes

N/A

The date-time string that includes a timezone offset.

Returns: string. The date-time in UTC, formatted as yyyy-MM-ddTHH:mm:ssZ.

Example: ConvertToUtcFormat("2024-01-15T10:30:00-05:00") returns "2024-01-15T15:30:00Z".

When to use it: When mapping a date-time to Mailchimp and it expects a UTC ISO 8601 value.

Related Documents

Did this answer your question?