Partner Integration
CoConnect Hub rewards members for actions they take on your platform: signing up, depositing, trading, reaching a level, or anything else. Your server tells CoConnect when an action happens, and CoConnect rewards the member within seconds.
- Use your own event names. There is nothing to map on your side.
- Your events never set an XP amount. Each task’s reward is configured on CoConnect.
- Everything runs on your server. Nothing is added to your web pages.
CoConnect sends you a token in a separate message. Keep it on your server.
Step 1: Install the SDK
Node.js
npm install @coconnect/sdkStep 2: Keep the CoConnect ID
Members arrive from CoConnect with ?cc_id=ck_… in the link. Save it in a cookie when they land, then save it with their account when they sign up. The cookie keeps it through redirects such as Google sign-in.
Node.js
import { ccIdFromUrl } from "@coconnect/sdk";
// Express shown; any framework works the same way.
app.use((req, res, next) => {
const ccId = ccIdFromUrl(req.originalUrl);
if (ccId) res.cookie("cc_id", ccId, { maxAge: 30 * 864e5, httpOnly: true, secure: true, sameSite: "lax" });
next();
});In another language, read the cc_id query parameter, accept it only if it has 4 to 64 letters, digits, _ or -, and set the cookie.
Step 3: Send an event
Send the cc_id with the user’s first event. After that, your own user ID is enough.
Node.js
import { CoConnect } from "@coconnect/sdk";
const hub = new CoConnect({ token: process.env.COCONNECT_TOKEN });
await hub.send("user_registered", { user: "u_1001", ccId: user.ccId });That is the whole integration. Next: