# Extensibility

Extensibility is used when the default Klaviyo connector behavior does not match the Brand’s data model.

The most common extension is **multi-list subscription routing**.

<details>

<summary><strong>Real-world examples</strong></summary>

* A Brand routes `consents_email` to a “Newsletter” list and `consents_sms` to a “VIP SMS” list.
* A partner needs custom list routing based on store, language, or program.

</details>

### Custom mapping&#x20;

```
/**
 * Maps The Wallet crew account data to Klaviyo format.
 *
 * @param {Object} account - Data coming from The Wallet Crew
 * @param {Object} data - Data sent to Klaviyo. Standard mapping is already applied on this object.
 */
function mapToKlaviyo(account, data){
  const phoneNumber = account["phoneNumber"]
  if(phoneNumber){
    data.phone_number = phoneNumber; 
  }
}

export default function(context) {
  context.register('extensions.klaviyo.mapper', {
    MapToKlaviyo: mapToKlaviyo
  });
}
```

### Multiple list subscriptions via `/server/script/klaviyo.js`

This pattern replaces the single `listId` configuration.

Implementation details and code example: [Multiple lists (advanced)](/connect/marketing-automation/klaviyo/setup.md#multiple-lists-advanced).

### Rollout and safety guidance

A conservative rollout reduces surprises in segmentation and consent.

* Start in staging.
* Validate on a small set of test profiles.
* Monitor events and profile properties in Klaviyo.
* Roll back by removing the script entry point, then re-test.

### FAQ

<details>

<summary><strong>Does a script change affect existing profiles?</strong></summary>

Yes. Once deployed, scripts can change how subscription updates are computed for any profile that goes through an enrolment flow.

Validation in staging is recommended.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thewalletcrew.io/connect/marketing-automation/klaviyo/extensibility.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
