> For the complete documentation index, see [llms.txt](https://docs.thewalletcrew.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thewalletcrew.io/connectors/marketing-automation/klaviyo/extensibility.md).

# 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

```
/**
 * 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)](broken://spaces/WLc8AHXW4tdrAXUBfrYF/pages/it9epkf147YHGRQ6gUKr#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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
