Skip to content

WebEngage

Connect WebEngage to JustAI to run AI-optimized copy experiments in your existing campaigns. WebEngage fetches the best content variant for each recipient at send time through a Content API, and JustAI learns from the opens and clicks you send back.

  1. You create a Content API in WebEngage that points to JustAI’s content endpoint.
  2. At send time, WebEngage calls JustAI for each recipient and gets back copy (subject, preheader, HTML body, and a copy ID) that you insert into your message.
  3. In Journeys, you split traffic: the control path keeps your current email as the baseline, and the treatment path uses the JustAI content.
  4. WebEngage sends campaign events (sends, opens, clicks) back to JustAI via Data Pipelines or batch exports.
  5. JustAI joins those events with its record of which copy each recipient received to measure control-vs-treatment performance and serve better copy over time.
  • Your JustAI org slug — usually your company name in lowercase (ask us if you’re not sure).
  • A JustAI API key to authenticate WebEngage’s calls (ask us if you don’t have one).
  • The template ID (template_id) of the JustAI template you want to serve.
  • Access to WebEngage Settings (to add a Custom Content API) and to Journeys.

Step 1 — Create a Content API pointing to JustAI

Section titled “Step 1 — Create a Content API pointing to JustAI”
  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: <JUSTAI_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.
  3. Set the request type to POST and the response type to JSON.

Send engagement events for both control and treatment back to JustAI so it can measure which copy wins.

Section titled “Option A — WebEngage Data Pipelines / Webhooks (recommended, near-real-time)”
  1. Ask WebEngage to enable Data Pipelines (Event Webhooks).
  2. Ask JustAI to validate the WebEngage payload mapping for your organization.
  3. Configure a new webhook destination:
    • https://worker.justwords.ai/api/webhook/events/<org_slug>
    • Headers:
      • X-Api-Key: <JUSTAI_API_KEY>
      • Content-Type: application/json
  4. Select only the event types included in the validated mapping:
    • Email Sent
    • Email Opened
    • Email Clicked
    • Email Unsubscribed
    • Email Bounced
  5. Include identifiers in the payload:
    • campaign_id
    • variation_id (A/B branch)
    • user_id
    • email
    • event_time
    • optionally justai_copy_id (if you inject it into the email body as a hidden comment or UTM param)

Example payload → JustAI event (illustrative; the accepted shape depends on your mapping):

{
"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}}",
"justai_copy_id": "{{justai_copy_id}}"
}
}

How JustAI uses these events: they are joined (by user_id/email, campaign_id, and timestamp) with JustAI’s serve logs from the Content API — the record of which copy each recipient received, including 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, justai_copy_id, and user attributes.
  4. Use the org-specific bucket and prefix provided by JustAI.

JustAI reads the exports daily to update per-copy performance metrics.

Build the experiment in Journeys, with a control path (your current email) and a treatment path (JustAI copy):

  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 block below.
  4. Launch the campaign to compare performance between control and AI-generated copy.

In the WebEngage HTML editor (or your “Dynamic Content” block), call the Content API and insert the returned copy:

{% 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 -->
<!-- JUSTAI_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.

Pass user attributes to the JustAI Content API so it can tailor copy to each recipient, and use safe defaults anywhere you reference attributes directly.

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 JustAI can return gender- or cohort-specific copy.
  • Optionally, layer an A/B split within each segment to test per-segment winners.

Example