WebEngage
Before You Start
Section titled “Before You Start”- Identify your JustAI org slug (usually your company name in all lower case - feel free to ask us).
Set up a JustAI test in WebEngage
Section titled “Set up a JustAI test in WebEngage”Create a Content API pointing to JustAI
Section titled “Create a Content API pointing to JustAI”- 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_KEYContent-Type: application/json
- Name:
- Enable parameters you’ll pass to the API (for personalization and variant generation):
user_idemailgendercohortlifecycle_stage- etc.
-
- Set request type →
POST - Response type →
JSON
- Set request type →
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”- In Journeys, add an A/B Split Node.
- Path A (Control): your standard email.
- Path B (Treatment): clone the email and replace the body (or subject) with the JustAI Jinja block above.
- 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)”Option A — WebEngage Data Pipelines / Webhooks (Recommended, near-real-time)
Section titled “Option A — WebEngage Data Pipelines / Webhooks (Recommended, near-real-time)”- 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_KEYContent-Type: application/json
- Configure a new webhook destination:
- Select event types:
- Email Sent
- Email Opened
- Email Clicked
- Email Unsubscribed
- Email Bounced
- Include identifiers in payload:
campaign_idvariation_id(A/B branch)user_idemailevent_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:
- Configure daily exports to S3 (or Redshift/BigQuery).
- Include events: send, open, click, unsubscribe.
- Add identifiers:
campaign_id,variation_id,jw_copy_id, and user attributes. - 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.
Example Personalization Tests
Section titled “Example Personalization Tests”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.
Segment-based variants
Section titled “Segment-based variants”- Ensure user attributes like
gender,plan_type, orcohortare 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.
