# 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)](https://docs.thewalletcrew.io/connect/marketing-automation/setup#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>
