Skip to main content
Templates let you centralize subject/body content with variables you can render server‑side, then send with personalized values. Status: beta. Endpoints may be limited or evolving. SDK usage (Node)
import { Fluxomail } from '@fluxomail/sdk'

const fm = new Fluxomail({ apiKey: process.env.FLUXOMAIL_API_KEY })

// Create
const t = await fm.templates.create({
  name: 'Welcome',
  subject: 'Hi {{name}}',
  htmlContent: '<h1>Hi {{name}}</h1>'
})

// Update
await fm.templates.update(t.id, { subject: 'Hello {{name}}' })

// Get
const latest = await fm.templates.get(t.id)

// List
const list = await fm.templates.list({ limit: 10 })

// Render (server-side)
const rendered = await fm.templates.render(t.id, { variables: { name: 'Pat' } })
// rendered.subject, rendered.html, rendered.content

// Delete
await fm.templates.delete(t.id)
Notes
  • Rendering is intended for server‑side environments.
  • Provide variables in a flat object; nested objects are supported as JSON.
  • You can mix content (text) and htmlContent fields in templates.
Sending with rendered content
const r = await fm.templates.render(t.id, { variables: { name: 'Pat' } })
await fm.sends.send({
  to: 'user@example.com',
  subject: r.subject || 'Hello',
  content: r.content,
  htmlContent: r.html
})
API endpoints (subject to change)
  • POST /api/v1/templates
  • GET /api/v1/templates
  • GET /api/v1/templates/{id}
  • PUT /api/v1/templates/{id}
  • DELETE /api/v1/templates/{id}
  • POST /api/v1/templates/{id}/render
See also: SDKs & Clients