> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# UpdateComposer

# Package: emailMarketing

# Namespace: CampaignService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/campaign/update-composer.md

## Permission Scopes:
Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING

## Introduction

Updates a campaign's editor data, including the content and subject line.

The `composerDataJson` format must match the campaign's existing `campaignEditorType`. Passing a mismatched format causes a silent failure when sending or previewing the campaign.

---

## REST API

### Schema

```
 Method: updateComposer
 Description: Updates a campaign's editor data, including the content and subject line.  The `composerDataJson` format must match the campaign's existing `campaignEditorType`. Passing a mismatched format causes a silent failure when sending or previewing the campaign.
 URL: https://www.wixapis.com/email-marketing/v1/campaigns/{campaignId}/composer
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  composer.composerDataJson
 Method parameters: 
   param name: composer | type: Composer | description: Represents a campaign's editor data that is used to render the campaign in the editor and viewer.  
        - name: composerDataJson | type: string | description: Editor content for the campaign. The format depends on `campaignEditorType`:  - `WEB`: Wix proprietary JSON format used by the drag-and-drop email editor. - `MOBILE`: A subset of the `WEB` format, used by the mobile email editor. - `MJML`: MJML markup wrapped in a JSON object under key "mjml".  Passing the wrong format for the given `campaignEditorType` causes a silent failure when sending or previewing the campaign. | required: true | validation: maxLength 10000000
        - name: defaultValues | type: DefaultValues | description: Fallback values for dynamic placeholders in the campaign content.  
           - name: map | type: object | description: Map of placeholder keys to their default values.  | validation: maxItems 500, format map
   param name: emailPreheader | type: emailPreheader | description: Short preview text shown after the subject line in some email clients (optional).  | validation: maxLength 1000
   param name: emailSubject | type: emailSubject | description: Subject line displayed in recipients' inboxes (optional).  | validation: maxLength 1000
 Return type: UpdateComposerResponse
  EMPTY-OBJECT {}


```

### Examples

### Update Composer
Update a campaign's editor data and subject line.

```curl
curl -X POST \
'https://www.wixapis.com/email-marketing/v1/campaigns/943602e1-633b-4577-ab39-43cba3dc17aa/composer' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "composer": {
    "composerDataJson": "{\"mjml\":\"<mjml><mj-body><mj-section><mj-column><mj-text>Summer Sale! Get 20% off all products this week.</mj-text></mj-column></mj-section></mj-body></mjml>\"}"
  },
  "emailSubject": "Summer Sale Extended - 25% Off Everything",
  "emailPreheader": "We extended our sale just for you"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.emailMarketing.campaigns.updateComposer(campaignId, options)
 Description: Updates a campaign's editor data, including the content and subject line.  The `composerDataJson` format must match the campaign's existing `campaignEditorType`. Passing a mismatched format causes a silent failure when sending or previewing the campaign.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  campaignId, options.composer.composerDataJson
 Method parameters: 
   param name: campaignId | type: string | description: Campaign GUID. | required: true | validation: format GUID
   param name: options | type: UpdateComposerOptions  none  
        - name: composer | type: Composer | description: Updated campaign editor data.  
           - name: composerDataJson | type: string | description: Editor content for the campaign. The format depends on `campaignEditorType`:  - `WEB`: Wix proprietary JSON format used by the drag-and-drop email editor. - `MOBILE`: A subset of the `WEB` format, used by the mobile email editor. - `MJML`: MJML markup wrapped in a JSON object under key "mjml".  Passing the wrong format for the given `campaignEditorType` causes a silent failure when sending or previewing the campaign. | required: true | validation: maxLength 10000000
           - name: defaultValues | type: DefaultValues | description: Fallback values for dynamic placeholders in the campaign content.  
              - name: map | type: object | description: Map of placeholder keys to their default values.  | validation: maxItems 500, format map
        - name: emailSubject | type: string | description: Subject line displayed in recipients' inboxes (optional).  | validation: maxLength 1000
        - name: emailPreheader | type: string | description: Short preview text shown after the subject line in some email clients (optional).  | validation: maxLength 1000
 Return type: PROMISE<UpdateComposerResponse>
  EMPTY-OBJECT {}


```

### Examples

### Update a campaign's editor data
Updates the composer data, subject line, and preheader for a campaign.

```javascript
import { campaigns } from "@wix/email-marketing";

export async function updateComposer(campaignId) {
  await campaigns.updateComposer(
    campaignId,
    {
      composer: {
        composerDataJson: "{\"mjml\":\"<mjml><mj-body><mj-section><mj-column><mj-text>Summer Sale! Get 20% off all products this week.</mj-text></mj-column></mj-section></mj-body></mjml>\"}",
      },
      emailSubject: "Summer Sale Extended - 25% Off Everything",
      emailPreheader: "We extended our sale just for you",
    },
  );
}

```

### updateComposer (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { campaigns } from '@wix/email-marketing';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { campaigns },
  // Include the auth strategy and host as relevant
});


async function updateComposer(campaignId,options) {
  const response = await myWixClient.campaigns.updateComposer(campaignId,options);
};
```

---