Skip to content

MoEngage

  • Identify your JustAI org slug (usually your company name in all lower case - feel free to ask us).
  1. In MoEngage, go to Settings → Advanced → Content APIs → Add.
  2. Name it something like JustAI and set the URL to your JustAI content endpoint:
    • https://worker.justwords.ai/api/generate/<org_slug>?template_id=<template_id>
    • Headers: X-Api-Key: JW_API_KEY
  3. Enable parameters you’ll pass (e.g., user_id, gender, cohort, etc.).

Example usage in your MoEngage email content (treatment path):

{# Call the Content API you added as "JustAI" #}
{% set jw = ContentApi.JustAI({
"params": {
"email": UserAttribute['Email']|default(''),
"user_id": UserAttribute['ID']|default(''),
"gender": UserAttribute['Gender']|default('')
},
"static_params": {},
"dynamic_params": {},
"request_body": {}
}) %}
{# Insert HTML returned by JustAI #}
{{ jw.copy.vars.body }}
{# Optional for analytics/debugging #}
<!-- JW_COPY_ID: {{ jw.copy.id|default('') }} -->

Notes:

  • You can also personalize Subject/Preheader using values from UserAttribute[...] and safe defaults.
  • If your workspace exposes a different helper (e.g., contentapi('JustAI', params={...})), adapt the call accordingly.
  1. Flows → Add “A/B Split”. Put your standard email on Path A (Control).
  2. Clone to Path B (Treatment) and replace the content with the block above that calls the JustAI Content API.

Send metrics back to JustAI (control & treatment)

Section titled “Send metrics back to JustAI (control & treatment)”
Section titled “Option A — MoEngage Streams (recommended, near‑real‑time)”
  1. Ask MoEngage to enable Streams for your account.
  2. Configure Streams → Destination: HTTPS/Webhook to your JustAI events endpoint with auth.
    1. https://worker.justwords.ai/api/webhook/moengage/<org_slug>
  3. Select campaign interaction events (Email Sent, Open, Click, Unsubscribe, Bounce, etc.).
  4. Include identifiers in the payload: campaign_id, variation_id (A/B path), event_time, user_id, email, and any custom properties you add (e.g., jw_copy_id if you inject it into the HTML as a hidden comment or link param).

Example transform → JW event (illustrative):

{
"platform": "moengage",
"channel": "email",
"event": "email_click",
"campaign_id": "{{campaign_id}}",
"variation_id": "{{variation_id}}",
"user_id": "{{user_id}}",
"email": "{{email}}",
"timestamp": "{{event_time}}",
"metadata": {
"flow_id": "{{flow_id}}",
"link_id": "{{link_id}}",
"jw_copy_id": "{{jw_copy_id}}"
}
}

How JustAI uses it: We join Streams events (by user_id/email, campaign_id, timestamp) with the content-serve logs from the JustAI Content API (which include copy_id). That yields per‑copy and per‑branch (control vs treatment) opens/clicks.

If Streams isn’t available, configure S3 exports (or Redshift/BigQuery/Snowflake) and let JustAI ingest daily drops under an org‑specific prefix. Export the same event set (sends/opens/clicks/unsubs) with campaign_id, variation_id, and user identifiers for attribution.

Testing copy for first‑name personalization & segment variations

Section titled “Testing copy for first‑name personalization & segment variations”

First‑name personalization (with safe fallbacks)

Section titled “First‑name personalization (with safe fallbacks)”
{% set first = UserAttribute['First name'] %}
{% if first %}
Hi {{ first }},
{% else %}
Hi there,
{% endif %}

Tip: Use defaults everywhere you reference user attributes. If your workspace supports a “do not send” fallback token, you can gate certain sends on presence (e.g., default to a token that suppresses the message) — otherwise, branch in the Flow or segment.

  1. Ensure attributes (e.g., Gender) are tracked on user profiles.
  2. Create segments in Segments → Create Segment (e.g., Gender == 'Male', Gender == 'Female', etc.).
  3. In your treatment path, pass these attributes to the JustAI Content API (gender, cohort, lifecycle_stage, etc.) so JustAI can return segment‑specific variants.
  4. Optionally run A/B inside each segment to select segment‑specific winners.