AI auto-replies with Publiq
Combine an LLM with Publiq variables to generate personalized replies at scale, keeping the template consistent.
Generate only the dynamic snippet with the LLM and pass it as a variable — the layout stays in the template:
const summary = await generateSummary(ticket); // your LLM call
await publiq.emails.send({
from: 'support@yourdomain.com',
to: ticket.email,
templateKey: 'support-reply',
variables: {
first_name: ticket.name,
ai_summary: summary, // -> {{ ai_summary }} in the template
},
});Best practices
- Always call Publiq from the server — never expose the API key on the client.
- Create the client instance once and reuse it across requests.
- Prefer
templateKeyover inline HTML to keep content versioned. - Handle
PubliqError(status/code); the SDK already retries transient errors with backoff. - Send from a verified domain — see Domains.