知识库

Connect your website to Zinn® Campaigns: Node.js, Next.js and Moodle

Send every sign-up from your own site into Zinn® Campaigns with our npm package or our Moodle plugin. Each lead arrives labelled with the platform and the form, with its consent.

Zinn®,我们的维京人,正在一篇打开的文章旁的索引边阅读他的检查清单。

Zinn® Campaigns can take sign-ups straight from your own website, wherever it is hosted. You create a site key, add one of our connectors, and every form sign-up arrives in Zinn® Campaigns as a contact. Public page: https://zinndigital.com/campaigns/integrations

1. Create a site key

In your dashboard open Campaigns → Connect a website and create a key for the site. The key starts with zcs_. Keep it on your server: it never goes into a page a visitor loads. Store it as an environment variable, for example ZINN_CAMPAIGNS_SITE_KEY.

2. Add a connector

Next.js

Install the package with npm install @zinn-digital/campaigns and add a route handler:

// app/api/newsletter/route.ts
import { createLeadRoute } from "@zinn-digital/campaigns/next";

export const { POST } = createLeadRoute({
  siteKey: process.env.ZINN_CAMPAIGNS_SITE_KEY!,
  form: "Newsletter",
});

A server action is available too (createLeadAction()). The labels are set on the server, so a visitor cannot change them.

Node.js, Express and Fastify

import express from "express";
import { zinnLeadsExpress } from "@zinn-digital/campaigns/node";

const app = express();
app.post(
  "/newsletter",
  express.urlencoded({ extended: false }),
  zinnLeadsExpress({ siteKey: process.env.ZINN_CAMPAIGNS_SITE_KEY!, form: "Newsletter" }),
);

Fastify uses zinnLeadsFastify() with the same options. Any other framework can call createLeadHandler() with the posted form fields.

React form

@zinn-digital/campaigns/react has a ready sign-up form with English and Arabic text, right-to-left ready. It posts to your own route, and your route adds the key.

Moodle

Install the Zinn® Campaigns for Moodle plugin (local_zinncampaigns) from your dashboard, under Plugins and modules. Go to Site administration → Plugins → Local plugins → Zinn® Campaigns, paste the site key and choose what to send: new sign-ups, course enrolments or both. Leads are sent in the background by Moodle's task runner, so a slow network never slows a sign-up. Each enrolment is labelled with the course name.

Any other site

Post the lead to https://api.zinndigital.com/v1/public/email-marketing/connect/leads with Authorization: Bearer <site key> and a JSON body with at least email. Send an Idempotency-Key header so a retry never makes a duplicate.

3. Labels, source and consent

Every lead is labelled with the platform and the form, such as Next.js: Newsletter or Moodle: Introduction to Biology. The platforms are:

  • Node
  • Next.js
  • Moodle

You can add your own labels as well (up to 20), so you always know which site and form a contact came from.

Send the consent box and the exact text the visitor agreed to. Both are stored with the contact. An address that unsubscribed or bounced is never added back.

What the API answers

  • 201 — the lead was accepted (a new contact, a contact who joined a list, or an address that is suppressed and was left alone).
  • 200 with duplicate — the same idempotency key was already used; nothing changed.
  • 401 — the site key is wrong or was removed. Create a new one.
  • 403 — the site is not connected yet, or the connection was turned off.
  • 429 — too many leads at once. Wait for the number of seconds in Retry-After.

The npm package and the Moodle plugin handle each of these for you.

本文尚未翻译成您的语言,因此您正在阅读英文版本。

博客最新动态

我们关于托管、SEO 和大规模网站运营的撰文。

来自托管层的 SEO 与外链建设:2026 年运营商视角

虚拟主机如何在 2026 年影响收录与链接资产传递(link equity):保持页面被有效索引、在建站前严格审查老域名、构建无痕迹(footprint)的外链,以及客观剖析底层基础设施在 SEO 方面的能力与局限。

阅读文章 →

让 WordPress 更快更安全:性能与插件核对清单

打造快速、安全的 WordPress 的实用核对清单:服务器级缓存、按站点设置的对象缓存、少数几个值得运行的插件、保持技术栈最新,以及绝不能进行缓存的 WooCommerce 页面。

阅读文章 →

如何在 2026 年选择托管型虚拟主机:买家指南

究竟是什么将优质的托管服务与带控制面板的廉价主机区分开来——迁移、备份、隔离、真正的缓存以及诚实的扩展能力——以及如何在您做出决定之前对其进行评估。

阅读文章 →

阅读博客 →

仍需帮助?

每个套餐均包含技术支持,客服团队全天 24 小时在线,您可以用我们支持的任意 58 种语言与我们联系——我们将用您的语言为您解答。

联系支持团队 所有文章