Skip to content

WebEngage

  • Identify your JustAI org slug (usually your company name in all lower case - feel free to ask us).
  1. In WebEngage, go to: Settings → Data Platform → Custom Content APIs → Add new API
    • Name: JustAI
    • Endpoint URL: https://worker.justwords.ai/api/generate/<org_slug>?template_id=<template_id>
    • Headers:
      • X-Api-Key: JW_API_KEY
      • Content-Type: application/json
  2. Enable parameters you’ll pass to the API (for personalization and variant generation):
    • user_id
    • email
    • gender
    • cohort
    • lifecycle_stage
    • etc.
    • Set request typePOST
    • Response typeJSON

Example usage inside WebEngage message editor

Section titled “Example usage inside WebEngage message editor”

Within the WebEngage HTML editor (or your “Dynamic Content” block):

{% set jw = callContentApi('JustAI', {
"params": {
"email": user.email|default(''),
"user_id": user.id|default(''),
"gender": user.gender|default(''),
"cohort": user.cohort|default('')
}
}) %}
<!-- Insert the HTML returned by JustAI -->
{{ jw.copy.vars.body|safe }}
<!-- Optional debug/analytics marker -->
<!-- JW_COPY_ID: {{ jw.copy.id|default('') }} -->

Notes:

  • You can also use {{ jw.copy.vars.subject }} or {{ jw.copy.vars.preheader }} in your subject line/preheader fields.
  • If your workspace uses contentapi() or a different helper, adapt the syntax.
  • Always include safe defaults for missing attributes.

Build the experiment in Journeys / Campaigns

Section titled “Build the experiment in Journeys / Campaigns”
  1. In Journeys, add an A/B Split Node.
  2. Path A (Control): your standard email.
  3. Path B (Treatment): clone the email and replace the body (or subject) with the JustAI Jinja block above.
  4. Launch the campaign to compare performance between control and AI-generated copy.

Send metrics back to JustAI (Control & Treatment)

Section titled “Send metrics back to JustAI (Control & Treatment)”
Section titled “Option A — WebEngage Data Pipelines / Webhooks (Recommended, near-real-time)”
  1. Ask WebEngage to enable Data Pipelines (Event Webhooks).
    • Configure a new webhook destination: https://worker.justwords.ai/api/webhook/webengage/<org_slug>
    • Headers:
      • Authorization: Bearer JW_API_KEY
      • Content-Type: application/json
  2. Select event types:
    • Email Sent
    • Email Opened
    • Email Clicked
    • Email Unsubscribed
    • Email Bounced
  3. Include identifiers in payload:
    • campaign_id
    • variation_id (A/B branch)
    • user_id
    • email
    • event_time
    • optionally jw_copy_id (if you inject it into the email body as a hidden comment or UTM param)

Example payload → JustAI event:

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

🧠 How JustAI uses it:

These webhook events are joined (by user_id/email, campaign_id, and timestamp) with JustAI’ serve logs from the Content API (which include copy_id). This enables copy-level lift tracking (open/click/conversion).

Option B — Batch Exports to S3 / Warehouse

Section titled “Option B — Batch Exports to S3 / Warehouse”

If your WebEngage account doesn’t have Pipelines:

  1. Configure daily exports to S3 (or Redshift/BigQuery).
  2. Include events: send, open, click, unsubscribe.
  3. Add identifiers: campaign_id, variation_id, jw_copy_id, and user attributes.
  4. Point JustAI to the bucket prefix (e.g., s3://jw-ingest/webengage/<org_slug>/events/).

JustAI will ingest daily to update per-copy performance metrics.

First-name personalization (safe fallback)

Section titled “First-name personalization (safe fallback)”
{% set first = user.first_name %}
{% if first %}
Hi {{ first }},
{% else %}
Hi there,
{% endif %}

Always provide defaults. Use conditional logic to avoid blank greetings or malformed text.

  • Ensure user attributes like gender, plan_type, or cohort are tracked in WebEngage user profiles.
  • Pass them as parameters to the JustAI API so the engine can return gender- or cohort-specific copy.
  • Optionally, layer an A/B split within each segment to test per-segment winners.

Example