Integrating
Website chat widget
A chat button for your website, with one script tag and one server endpoint.
For a chat button on your site, without writing any front-end code:
HTML
<script src="https://spiiksi.com/support-widget.js"
data-session-endpoint="/api/spiiksi-session"
data-label="Chat with us"
async></script>When a visitor presses the button, the widget calls your endpoint; your server starts a chat with your key and answers {"customer_url": "…"}. The chat opens in a panel on your page, in the visitor's language. Your agents answer in Spiiksi's support desk, or through the API.
JavaScript
app.post("/api/spiiksi-session", async (req, res) => {
const session = await fetch("https://api.spiiksi.fi/v1/sessions", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.SPIIKSI_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ agent_language: "en", agent_name: "Acme Support" }),
}).then((r) => r.json());
res.json({ customer_url: session.customer_url });
});| Attribute | Notes |
|---|---|
data-session-endpoint | Your endpoint, called with POST and {page, language}. |
data-label | The button's text. |
data-color | The button's color. |
data-position | left puts the button on the left. |
The widget remembers the chat for the browser tab, and starts a new one after the chat ends. window.SpiiksiSupport.open(url) opens a chat you already have. For calls and more control, use the JavaScript SDK.