FluxyChat

Cookbook

Message templates

Project-scoped templates with `\{\{variable\}\}` substitution for system/bot messages.

Project-scoped templates with \{\{variable\}\} substitution for system/bot messages.

Admin API (JWT with admin or owner role)

MethodPathDescription
GET/templatesList templates
POST/templatesCreate \{ name, body \}
GET/templates/:idRetrieve
PATCH/templates/:idUpdate
DELETE/templates/:idDelete
POST/templates/renderPreview \{ templateId, vars \} or \{ body, vars \}

Send via REST

curl -X POST "$WORKER_URL/messages" \
  -H "Authorization: Bearer $MEMBER_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "roomId": "support-1",
    "templateId": "tpl_...",
    "templateVars": { "name": "Jane", "ticketId": "42" }
  }'

content is optional when templateId is set (rendered server-side).

SDK

import { renderMessageTemplate } from "@fluxy-chat/sdk";

const preview = renderMessageTemplate("Hi {{name}}", { name: "Jane" });

await client.createMessage(roomId, "", null, undefined, clientMessageId, {
  templateId: "tpl_...",
  templateVars: { name: "Jane", ticketId: "42" },
});

Member preferences

curl -X PATCH "$WORKER_URL/rooms/$ROOM_ID/members/me/preferences" \
  -H "Authorization: Bearer $MEMBER_JWT" \
  -H "Content-Type: application/json" \
  -d '{"notifyEnabled": true, "preferences": {"locale": "en-GB"}}'

GET /rooms/:id/members returns notifyEnabled and preferences per member.

On this page