Developers
Get started
1. Install the library
npm install anemone-server-js2. Initialize the client
Point baseUrl at your Anemone environment. Production must use https; the client rejects plain http except for localhost / 127.0.0.1 when you opt in. The demo builds the client in getAnemoneClientOrNull and pushes updates via pushContactUpdatesToPrimary.
import { AnemoneClient } from "anemone-server-js";
const client = new AnemoneClient({
baseUrl: "https://api.your-anemone.com",
apiKey: process.env.ANEMONE_API_KEY!, // secret — server only
allowInsecureLocalhost: true, // dev only; omit in production
});
await client.saveContactInfo(
{
externalUserId: "user-123", // your product’s user id, not Anemone internal id
kind: "address",
address: {
line1: "123 Main St",
city: "Seattle",
region: "WA",
postalCode: "98101",
countryCode: "US",
},
},
{ idempotencyKey: "update-2025-04-26-abc" } // safe retries
);4. Optional UI (account card)
If you want a sign-in / connect / disconnect panel in your app without building it from scratch, use the optional embed in anemone-server-js/embed or hand-roll the same flow with session probe helpers. See Optional UI for initialization, themes, the React sync card, and a full hand-roll example — or jump to the demo's ContactBasicPanel and CustomAnemoneContactUI.
5. Map your contact fields (optional)
If your user model uses different property names than Anemone, define a ContactInfoMapping once and reuse it for outbound PATCH bodies and inbound webhooks. See API — Contact field mapping.
6. Receive address changes (webhook)
When a user changes contact data in Anemone, we can notify your system with a signed contact.changed event. See the Webhooks page. Use the same package to verify signatures and parse payloads.
externalUserId; primary maps it to the end user via user_tenant_link.