PushizoDocs
Messaging & campaigns

AI content assistant (Claude, OpenRouter)

The AI assistant panel in the message and template editors suggests headings and body text, adjusts tone and length, generates A/B variants, scores email subject lines and produces approval-gated translations; in the inbox it summarizes conversations and suggests replies…

The AI assistant panel in the message and template editors suggests headings and body text, adjusts tone and length, generates A/B variants, scores email subject lines and produces approval-gated translations; in the inbox it summarizes conversations and suggests replies. The model provider can be Anthropic (Claude, directly) or OpenRouter (Claude, GPT, Gemini and others with a single key). Decision records: docs/adr/0028-data-feeds-dynamic-content-ai.md, docs/adr/0042-openrouter-ai-saglayicisi.md.

Setup

  1. Choose a provider and create a key:
    • Anthropic: Anthropic Console → API key (optional: zero data retention/ZDR setting for your org).
    • OpenRouter: openrouter.ai → Keys → create a key; add credits to the account. Under Settings → Privacy, turn off prompt retention/use for training (Pushizo also sends data_collection: deny with every request).
  2. Environment variables (.env; in production infra/compose/.env.prod):
VariableDefaultDescription
AI_PROVIDERanthropicanthropic, openrouter or mock (deterministic test provider).
ANTHROPIC_API_KEY—Secret; never logged. If empty while anthropic is selected, the mock is used.
AI_MODEL_DEFAULTclaude-sonnet-5-5Anthropic: suggestions, tone, variants, subject score, single-language translation, inbox.
AI_MODEL_LONGclaude-opus-5-5Anthropic: email bodies and multi-language/long translation.
OPENROUTER_API_KEY—Secret; never logged. If empty while openrouter is selected, the mock is used.
OPENROUTER_BASE_URLhttps://openrouter.ai/api/v1OpenAI-compatible API root.
OPENROUTER_MODEL_DEFAULTanthropic/claude-sonnet-5.5OpenRouter model ID (provider/model, e.g. openai/gpt-5.6-sol, google/gemini-3.8-flash).
OPENROUTER_MODEL_LONGanthropic/claude-opus-5.5OpenRouter model for long content.
OPENROUTER_FALLBACK_MODELS—Models tried in order if the primary model is unavailable (comma-separated, at most 3).
AI_TIMEOUT_MS90000Request timeout (for both providers).
AI_MAX_RETRIES3Retries with backoff for 408/429/529/5xx and connection errors.

The mock provider is also used when PROVIDER_MODE=mock. If the selected provider has no key, Pushizo does not silently fall back to the other provider. In production, mock output is not served without ALLOW_MOCK_PROVIDERS=true.

On OpenRouter, the selected model must support structured output (JSON schema); a model that doesn't, or that has no endpoint meeting the zero-data-retention requirement, returns 404 and the dashboard shows a clear error. For Anthropic models the system prompt is cached; for other providers caching is handled automatically by OpenRouter. 3. Organization settings → AI content assistant: turn the feature on (off by default), and set the monthly token quota and banned phrases. The card shows the active provider and models; this month's usage is listed by feature/model. 4. KVKK (Turkish data protection law): add the provider you chose (Anthropic, or OpenRouter and the model provider it routes to) to your sub-processor list; when the assistant is on, only template text and PII-masked conversation transcripts are sent.

Privacy

  • Only the template text in the editor is sent to the model; no user data is sent. Liquid expressions ({{ user.tags.ad }}, {% if … %}) are replaced with placeholders such as [[HS1]] and restored in the response.
  • Prompt and response contents are neither stored nor logged; only ai_usage (feature, model, tokens, time) is kept. Translation results are stored as product content for approval.

Features

  • Suggest / rewrite: Field (push heading ≤ 65, body ≤ 240, SMS ≤ 160, email subject ≤ 78, preheader ≤ 110), tone (formal, friendly, playful, urgent) and length (shorter/same/longer). Suggestions over the limit are truncated at a word boundary.
  • A/B variant: In the campaign editor, "Add to A/B" adds a variant in one click: if testing is off it is turned on, the first variant inherits the campaign content, and weights are split evenly (up to 10 variants). The winner is picked through the existing A/B flow (manually or by automatic metric).
  • Subject line score: A 0–100 score, reasons and improved suggestions; a subject containing phishing/banned phrases scores at most 20.
  • Translation: Target languages are chosen from the app's languages. Consistency glossary (…/ai/glossary): a term with an empty translation is never translated (e.g. a brand name), and a term with a per-language translation is always translated with that mandatory equivalent.

Translation approval (mandatory)

A translation is saved as "pending approval". Content containing the text of an unapproved (or rejected) translation cannot be sent: the notifications API, campaign send/schedule, editing a scheduled campaign and publishing a journey return 422 HS_CONTENT_INVALID (details.reason = ai_translation_unapproved). On the approval screen in the dashboard, the reviewer edits the text and clicks Approve and add; the approved text is added to the content as a language.

Quota and errors

  • When the monthly quota runs out, requests are rejected with 429 HS_QUOTA_EXCEEDED and a clear message; the quota resets at the start of the month (UTC).
  • 20 AI requests per minute per user.
  • Provider rate limit/overload: once retries are exhausted, 429 HS_RATE_LIMITED or 503 HS_PROVIDER_UNAVAILABLE; on a safety refusal a server-side fallback model is tried first, and if it also refuses, 422.
  • Suggestions containing banned phrases (platform phishing list + org list) are filtered out; a translation containing them cannot be approved.

API (dashboard session)

GET /internal/v1/apps/{appId}/ai/status, POST …/ai/suggest|variants|subject-score|translate, GET …/ai/translations, POST …/ai/translations/{id}/approve|reject, …/ai/glossary, GET|PUT /internal/v1/orgs/{orgId}/ai/settings, GET …/ai/usage.

On this page