Skip to main content

Introduction

Adobe Experience Manager (AEM) is an enterprise content management platform that enables organizations to create, manage, and deliver personalized digital experiences across multiple channels. Sync Experience Fragments and its variations directly as Email Templates in MoEngage. Allows marketing teams to author locale-specific email variations in AEM and have them automatically appear as a grouped, multi-locale email template in MoEngage.

Use Cases

  • Locale-Based Email Campaigns: Author one Experience Fragment with multiple locale variations (e.g., English, German, Italian). Each variation syncs as a child template grouped under a single parent in MoEngage, enabling MoEngage to automatically serve the right locale to each user.
  • Centralised Email Authoring: Keep all email HTML in AEM as the single source of truth. Any publish action automatically pushes the latest content to MoEngage email templates without manual export or copy-paste.
  • Multi-Variation Testing: Manage A/B or regional variants of an email inside a single AEM Experience Fragment, syncing each as a numbered variation in MoEngage’s template group.

How It Works

The sync follows a Parent + Child template model that maps directly to MoEngage’s Email Template grouping structure:
AEM StructureMaps ToNotes
XF Root PageTemplate GroupGroups all locale variations together in MoEngage
First XF Variation (child page)Parent Template (locale: EN)Always synced first. Its external_template_id becomes the group_id for all child templates
Subsequent XF VariationsChild TemplatesLocale detected automatically from the variation’s title or node name (e.g., -de_deDE_DE)

Locale Detection Logic

The workflow automatically detects the locale of each XF variation by matching a [-_][language][-_][country] suffix at the end of the variation’s page title or node name (e.g., promo-email-de_deDE_DE). The following locales are supported out of the box:
Locale CodeLanguage / Region
ENEnglish (default fallback)
DE_DEGerman (Germany)
IT_ITItalian (Italy)
ES_ESSpanish (Spain)
NL_NLDutch (Netherlands)
ID_IDIndonesian (Indonesia)
Locale FallbackIf no valid locale is detected from the variation title or node name, or if the detected locale is not in the supported list above, the workflow defaults the locale to EN and logs a warning. You can extend the VALID_LOCALES set in the implementation to support additional locales as needed.

Step 1: Add the Email Sync Workflow Step

Create a new file at the following path in your AEM project:
Sample ImplementationThe code below is a sample reference implementation intended as a starting point. It covers the core sync flow but may require adjustments to match your AEM project structure, locale list, sender details, or template naming conventions. Review the inline comments carefully and test thoroughly in a non-production environment before deploying. For implementation support or custom requirements, contact MoEngage Support or your Customer Success Manager.
MoEngageEmailSyncStep.java

Step 2: Create the Email Sync Workflow Model

  1. Navigate to Tools > Workflow > Models in AEM Author.
  2. Click Create > Create Model and enter the following details:
    1. Title: MoEngage Email Sync
    2. Name: moengage-email-sync
  3. Open the workflow for editing and delete the default step.
  4. Drag a Process Step from the sidebar onto the canvas.
  5. Double-click the Process Step to configure it.
  6. In the Process dropdown, select MoEngage Email Sync (Parent + Child - Stable).
  7. In the Arguments field, enter:
  8. Click OK to save, then click Sync to activate the workflow model.

Configuration Parameters

ParameterDescriptionRequired
moengage.api.keyYour MoEngage Workspace IDYes
moengage.api.secretYour MoEngage Campaign API Secret (used for Basic Auth)Yes
moengage.datacenterMoEngage data center code (e.g., 02, 03, 04)Yes
aem.publish.urlBase URL of your AEM Publish instance, used to externalize relative asset linksYes
moengage.debugEnable debug mode — sends payloads to the debug webhook before the MoEngage API call (true/false)No
moengage.debug.urlWebhook URL for payload inspection (e.g., webhook.site)No

Step 3: Configure the Workflow Launcher

Navigate to Tools → Workflow → Launchers and create a launcher for Experience Fragments:
Launcher NameEvent TypeNodetypePathConditionWorkflow
moengage-xf-email-syncModifiedcq:PageContent/content/experience-fragments/[your-site]cq:lastReplicationAction==Activatemoengage-email-sync
Important
  • Set Run Modes: author
  • Set Enabled: true
  • Replace [your-site] with your actual site path
  • If you are already using the MoEngage Content Sync launcher on the same XF path, ensure both launchers are scoped correctly to avoid double-processing. You can use path conditions or separate XF sub-folders to differentiate content-block XFs from email-template XFs.

Step 4: Test the Email Template Sync

Enable Debug Mode (Recommended for First Run)
For initial testing, add debug parameters to workflow arguments:
Get a free webhook URL from webhook.site.
  1. In AEM Author, navigate to the Experience Fragment you want to sync as an email template. Ensure it has at least one variation (child page). For locale-based grouping, ensure each variation’s title or node name ends with a locale suffix (e.g., promo-email-de_de).
  2. Select the page information icon and click Start Workflow.
  3. Select MoEngage Email Sync from the dropdown and click Start.
  4. Monitor crx-quickstart/logs/error.log for log entries prefixed with MoEngageEmailSyncStep to confirm parent and child template sync.
  5. In MoEngage, navigate to Content > Email Templates to confirm the template group was created with the correct locales.

Content Sync vs. Email Template Sync — Key Differences

Content Sync (MoEngageContentSyncStep)Email Sync (MoEngageEmailSyncStep)
MoEngage destinationContent BlocksEmail Templates
API endpoint/v1/external/campaigns/content-blocks/v1.0/custom-templates/email
Supported content typesExperience Fragments, Content Fragments, DAM AssetsExperience Fragments only
Locale / groupingNot applicable — each XF variation syncs as an independent blockVariations grouped as parent + children with locale codes
Update behaviourSearch by name → PUT if exists, POST if newAlways POST — creates a new template version each sync
Support and CustomisationThe sample code covers the core sync flow. Common customisations include adding more locales to VALID_LOCALES, customising the sender_name field per brand, or adjusting the locale detection regex to match your AEM naming conventions. For implementation assistance, contact MoEngage Support or your Customer Success Manager.