Integration recipes: Grafana, MoEngage, Retool, Segment device mode

Four ways to connect Lucida to tools you already run. Each one uses a public, documented surface; nothing here needs a custom build.

Embed
Preview of the card
<a href="https://lucidace.com/help/integration-recipes"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/37abc40b-0169-4abd-9775-ae1d170b05ce/social-card.svg?v=3e7ae33eec8b" alt="Integration recipes: Grafana, MoEngage, Retool, Segment device mode" width="600" height="315"></a>

Four ways to connect Lucida to tools you already run. Each one uses a public, documented surface; nothing here needs a custom build.

Grafana

Lucida data in Grafana panels. Use the BI endpoint (the one behind the Looker Studio connector) with Grafana's Infinity data source:

  1. Create a personal access token with read access to the project (Settings, API keys).

  2. In Grafana add an Infinity data source. Base URL: https://<your-lucida>/v1/projects/<project-id>/bi/tables. Add the header Authorization: Bearer <token> (Grafana keeps it as a secret).

  3. In a panel use type JSON, source URL, format Table, URL /web_overview for the totals, /web_channel for a breakdown or /insight_<id> for any saved insight, and set rows/root selector to rows. Columns come from the schema array of the same response.

  4. Large tables page: the response carries next_cursor; pass it back as ?cursor= (Infinity's pagination type "cursor", field next_cursor, query parameter cursor). ?limit= is the page size (default 10000).

  5. ?from= and ?to= take ISO dates; map them to Grafana's ${__from:date:YYYY-MM-DD} and ${__to:date:YYYY-MM-DD}.

Lucida events on Grafana dashboards. Add the Grafana annotations destination (Connectors, Destinations). Settings: your Grafana URL (base_url). Credential: a service account token with annotations:write. Route the events you want to see (releases, flag changes, alert events) with a filter; each one becomes an annotation tagged lucida at the event time.

MoEngage

Add the MoEngage destination. Settings: workspace_id (also the Basic-auth user) and, for data centres other than 01, region (02 to 06). Credential: the Data API key from MoEngage under Settings, APIs. Events are sent as custom events (action = the event name, attributes = its properties, current_time in seconds); people are sent as customer attributes keyed by the distinct id. Use a route filter to send only the events your campaigns need, and a batched trigger to cap volume.

Retool

Retool talks to the same REST surface as everything else:

  1. Create a REST API resource. Base URL https://<your-lucida>/v1/projects/<project-id>; header Authorization: Bearer <personal access token>.

  2. For tables, a query against GET /bi/tables/<table>?limit=1000 returns {schema, rows, next_cursor}; transform with {{ data.rows.map(r => Object.fromEntries(r.map((v, i) => [data.schema[i].name, v]))) }} to feed a Table component. Follow next_cursor with a second query or a JS loop for more.

  3. For actions use the write endpoints you already have scoped keys for, for example POST /flags/<id>/toggle with {"enabled": true} behind a Retool confirmation modal. The token's role decides what works; a viewer token gets 404 on writes.

  4. To start a Retool Workflow from Lucida, create a Webhook destination pointing at the workflow trigger URL; or use the REST-hook triggers (/v1/projects/<pid>/rest-hooks) to subscribe it to an event, cohort entry or alert.

Segment device mode

If your pages already load Segment's Analytics.js, register Lucida as a device-mode destination so Lucida's replay, autocapture and consent handling run in the same page and see the same visitor:

import { init } from "@lucida-analytics/browser";
import { lucidaDestination } from "@lucida/integration-segment-device";

const lucida = init("lc_pk_...", { apiHost: "https://lucida.example.com" });
await analytics.register(lucidaDestination(lucida));

track becomes a Lucida event with the same name and properties, page a $pageview, screen a $screen, identify an identify (only once a userId exists), group a group call and alias a Lucida alias. Segment keeps its own consent categories: only register the plugin once the visitor has allowed analytics, or let Lucida's consent API (setConsent) gate it. For server-side Segment sources, use the Segment connector instead of device mode.

Updated