LidmeoDevelopers

TypeScript SDK

@lidmeo/sdk: installing, calling, errors, pagination, agencies, webhooks.

npm install @lidmeo/sdk

Node 18 or later, Deno or Bun: it needs fetch and node:crypto (not a browser, nor an edge runtime without Node compatibility). It is an ESM module: import everywhere; require("@lidmeo/sdk") works from Node 20.19 and 22.12. No dependency.

import { Lidmeo } from "@lidmeo/sdk";

const lidmeo = new Lidmeo({ apiKey: process.env.LIDMEO_API_KEY }); // lid_live_… or lid_test_…

// The prospects who replied and wait for you
const page = await lidmeo.prospects.list({ view: "to_handle" });

// Set your stage
await lidmeo.prospects.update("pros_…", { crm_stage: "stg_…" });

// Add a prospect to follow (nothing is sent to them)
await lidmeo.prospects.upsert({ match_on: "linkedin_url", linkedin_url: "https://www.linkedin.com/in/claire-durand" });

One method per operation, grouped by resource: lidmeo.prospects.notes.create(…), lidmeo.webhookEndpoints.rotateSecret(…), lidmeo.test.simulate(…). The types of parameters and responses come from the API's contract.

Options

OptionDefault
apiKeyprocess.env.LIDMEO_API_KEYa key or an OAuth token
accountnonethe account targeted by an agency key (acct_…)
languagenone (French)the language of errors, "fr" or "en" (Accept-Language header)
maxRetries2retries of a failing request (network, 408, 429, 5xx, and the transient 409 refusals of a write), never of a failed send or of switched-off sends (send_failed, sends_disabled)
timeoutMs60000timeout of one attempt
baseUrlhttps://api.lidmeo.com

Every method accepts call options as its last argument: idempotencyKey, account, language, timeoutMs, maxRetries, signal. A signal (AbortSignal) cancels the request; already aborted, nothing is sent.

Errors

Every error is a LidmeoError carrying the API's problem. Branch on code, never on the text.

import { LidmeoError } from "@lidmeo/sdk";

try {
  await lidmeo.prospects.approveInvitation("pros_…");
} catch (error) {
  if (error instanceof LidmeoError && error.code === "daily_cap_reached") {
    console.log("Next slot:", error.problem.next_slot_at);
  } else {
    throw error;
  }
}

error.status, error.code, error.detail, error.requestId (to give to support), error.errors (field by field) and error.problem (the whole problem). A network cut gives status: 0 and code: "network_error".

Pagination

for await (const prospect of lidmeo.paginate((q) => lidmeo.prospects.list({ ...q, view: "to_follow_up", limit: 100 }))) {
  console.log(prospect.full_name);
}

Webhooks

import { verifyWebhook, WebhookVerificationError } from "@lidmeo/sdk";

const event = verifyWebhook(process.env.LIDMEO_WEBHOOK_SECRET!, rawBody, request.headers);
if (event.type === "prospect.replied") {
  // event.data.object: the prospect
}

verifyWebhook throws a WebhookVerificationError when the signature, the timestamp (more than 5 minutes) or the headers are wrong: then answer 400. See verifying a signature.

On this page