Narro docs
Loading…
Put the program on your own pages with one script tag and one endpoint on your server. The widget runs in a Narro frame, so your page never handles a founder's data.
POST /widget-tokens answers 403 product_unavailable, with a test key and with a live key, and so does every call made with a widget token. This page describes how they will work. Nothing in your setup or go-live needs them, and a live key does not need the widget scope.div that names a widget, and a script tag for the Narro loader. The loader is small and holds no logic.The widget host is its own address, separate from the API host https://api.thenarro.com. Your server calls the API host to mint tokens. The Widgets shows the widget host in the install snippet for each widget, with your own settings filled in. The samples here write it as https://<your-widget-host>.
There are two ways to load the loader. The Hub shows both and fills in the host and, for a pinned install, the hash.
A pinned loader is one exact version at /v<version>/loader.js. It never changes, so the browser can check it against an integrity hash. You choose when to move to a newer version. Copy the hash from the Hub. Do not compute or type one by hand.
<div data-narro-program-widget="my_cohort"
data-token-url="/narro/widget-token/my_cohort"
data-fallback="Your cohort is not available right now."></div>
<script src="https://<your-widget-host>/v<version>/loader.js"
integrity="sha384-<hash-from-the-hub>"
crossorigin="anonymous" async></script>A channel URL follows a release channel inside one major version: stable or latest. Updates arrive without a reinstall and never cross a major version. The plain https://<your-widget-host>/v1/loader.js is the same as stable. A channel moves, so it cannot carry an integrity hash. The loader is tiny and holds no logic, and the widget itself runs inside the Narro frame, so the file that moves is not the code that handles data.
<div data-narro-program-widget="my_cohort"
data-token-url="/narro/widget-token/my_cohort"></div>
<script src="https://<your-widget-host>/v1/stable/loader.js" async></script>Older versions stay hosted while they are deprecated, for at least the six month overlap on Versioning. A channel change or a rollback reaches the loader within about a minute.
| Attribute | Meaning |
|---|---|
data-narro-program-widget | The widget id. Required. See the list below. |
data-token-url | A path on your site, or an https URL, that returns JSON with a token field. The loader calls it with same-origin credentials, so your own session identifies the founder. |
data-token | A token your server wrote into the page, instead of data-token-url. Use data-token-url unless you must render the token at page load. |
data-locale | en-CA, fr or es. Default is en-CA. |
data-target-ref | For intro_request only: the match or target reference the button is for. |
data-fallback | Text shown in place of the widget when it is unavailable. Optional. |
data-title | The title of the iframe, for screen readers. Optional. Default names the widget. |
data-portal-url | An https link the widget may open in a new tab when it asks to open your portal. Optional. |
Your endpoint is the URL in data-token-url. It checks that the visitor is signed in on your site, finds their fdr_ founder reference, calls POST /widget-tokens with the partner key, and returns the token. Mint a new token for each page view. A token is bound to one widget, one origin, and one founder or no founder, and lasts at most 10 minutes. ttl_seconds can ask for less, from 30 to 600.
// Your backend: the URL you put in data-token-url. Express shown; any framework works.
import express from 'express';
import { narro } from './narro-client.mjs';
const WIDGETS = ['enter_portal', 'my_cohort', 'module_materials', 'submit_deliverable', 'tier_a_this_week', 'ask', 'intro_request'];
const app = express();
app.get('/narro/widget-token/:widget', async (req, res) => {
const widget = req.params.widget;
if (!WIDGETS.includes(widget)) return res.status(404).end();
const founderRef = await founderRefFor(req); // your own session lookup: the fdr_ reference from your roster, or null when signed out
const body = { schema_version: 'standard.v1', widget, origin: 'https://<your-site-origin>' };
if (founderRef) body.founder_id = founderRef; // omit for an anonymous token (enter_portal only)
try {
const minted = await narro('POST', '/widget-tokens', body);
res.set('Cache-Control', 'no-store').json({ token: minted.token }); // valid for at most 10 minutes
} catch (error) {
res.status(502).json({ error: 'widget_unavailable' });
}
});
async function founderRefFor(req) {
return req.session && req.session.narroFounderRef ? req.session.narroFounderRef : null;
}
app.listen(3000);origin must be exactly the origin of the page that embeds the widget, with no wildcard, and it must be one of the origins registered for your key. A key with no allowed origins cannot mint widget tokens.founder_id only for an anonymous token. Only enter_portal accepts one.account_unresolved. Show the Enter portal widget first.Idempotency-Key. See Authentication. The response is not cached, so a retry gets a fresh token.config object. It does not change how a widget looks today. Set the theme in the Hub.You set these in the Hub, under the design settings of a widget, per key or per widget. Nothing else about the widget can be changed from your side.
| Setting | Rule |
|---|---|
| Display name | Short plain text. It is escaped, never treated as markup. |
| Logo | An https image URL on a host Narro allows: your registered origins, or a host Narro has approved for logos. |
| Primary and secondary color | Hex, like #1A2B3C. Each must reach a 4.5 to 1 contrast ratio against the widget background, or Narro uses its default for that color and the Hub warns you. |
| Color scheme | Light, dark or auto. Auto follows the visitor's setting. Each scheme is checked on its own background. |
If your pages send a Content Security Policy, allow the widget host to load the loader, to be framed, and to answer the loader's availability check:
Content-Security-Policy: default-src 'self';
script-src 'self' https://<your-widget-host>;
frame-src https://<your-widget-host>;
connect-src 'self' https://<your-widget-host>Your own token URL must also be allowed by connect-src. The widget needs no cookies of yours, no third-party script and no inline script on your page.
frame-ancestors policy with the origins registered for your key. A widget does not render on a page whose origin is not registered. It shows the neutral unavailable state.https://*.example.com. Plain http is allowed only for localhost, in staging.referrerpolicy="origin" on the iframe so Narro can check the embedding origin.sandbox attribute. Do not add attributes that change it.The widget talks to your page with postMessage, always to your page's exact origin and never to a wildcard. Each message is an object with narro: 1 and a type. There are three types, and none carries data.
| Type | Fields | Meaning |
|---|---|---|
ready | None | The widget finished loading. The loader replies with an ack. |
resize | height | The widget content height in pixels. The loader sizes the iframe between 60 and 4000. |
navigate | target | reload asks the loader to fetch a new token and remount. portal asks it to open your data-portal-url in a new tab, when you set one. |
No token, no founder detail and no content ever travels over postMessage. The Narro loader handles all three types. If you handle them yourself, check three things before you act:
// Only needed if you handle the widget messages yourself. The Narro loader already does this.
const WIDGET_ORIGIN = 'https://<your-widget-host>';
const frame = document.querySelector('iframe[title^="Narro"]');
window.addEventListener('message', (event) => {
if (event.origin !== WIDGET_ORIGIN) return; // wrong sender
if (!frame || event.source !== frame.contentWindow) return; // not your widget frame
const message = event.data;
if (!message || message.narro !== 1) return; // not a Narro message
if (message.type === 'resize' && typeof message.height === 'number') {
frame.setAttribute('height', String(Math.min(4000, Math.max(60, Math.ceil(message.height)))));
} else if (message.type === 'ready') {
// optional: the loader answers with { narro: 1, type: 'ack' }
} else if (message.type === 'navigate') {
// message.target is 'reload' (mint a new token and remount) or 'portal' (open your portal link)
}
});event.origin equals the widget host origin.event.source is the window of your own widget iframe.data.narro === 1. Ignore everything else.| Widget id | Shows | Credential |
|---|---|---|
enter_portal | Enter portal. A status card and a button into the Narro-hosted portal. An anonymous token is for the signed-out state. | Anonymous or founder |
my_cohort | My cohort. Cohort name, dates, the module schedule and the member count. | Founder |
module_materials | Module materials. The materials of a module, with links that expire. | Founder |
submit_deliverable | Submit deliverable. Upload and status for the open module. | Founder |
tier_a_this_week | Top matches this week. A few masked investor matches with the reason each was matched and an intro button. | Founder |
ask | Ask. A free-text question with results and an explanation. | Founder |
intro_request | Request warm intro. A request button and a status chip for one target. Needs data-target-ref. | Founder |
Some widgets are released in phases for a program. A widget that is not available yet shows a neutral gated state, not an error. Each widget calls only the routes below.
| Widget id | Routes it may call |
|---|---|
enter_portal | GET /me/accountGET /cohorts/{id} |
my_cohort | GET /cohorts/{id}GET /modules |
module_materials | GET /modulesGET /modules/{id}/materials |
submit_deliverable | GET /deliverables/{id}GET /modules/{id}/deliverablesPOST /modules/{id}/deliverablesGET /modules |
tier_a_this_week | GET /me/customersGET /me/customers/{ref}GET /me/investorsGET /me/investors/{ref}GET /me/introsPOST /me/introsGET /me/intros/{id}POST /me/intros/{id}:withdrawGET /me/matches/investorsGET /me/targets/customersGET /me/statuses |
ask | GET /founders/{ref}/queriesPOST /founders/{ref}/queriesGET /founders/{ref}/queries/{query_ref}POST /founders/{ref}/queries/{query_ref}:cancelPOST /founders/{ref}/queries/{query_ref}:regeneratePOST /founders/{ref}/queries/{query_ref}:retryPOST /founders/{ref}/voice-sessionsPOST /founders/{ref}/queryPOST /founders/{ref}/query/{id}/feedback |
intro_request | GET /me/introsPOST /me/introsGET /me/intros/{id}POST /me/intros/{id}:withdrawGET /me/statuses |
The warm intro request widget is a button and a status chip for one target. The founder writes a note and chooses what they are asking for. Narro decides whether a warm introduction is available or the request becomes a path request, and Narro runs the introduction. You can follow it with the intro.requested and intro.status_changed webhooks. See Webhooks.
Narro can switch off one widget, all of your widgets, or all widgets everywhere. The loader checks availability before it mounts anything, and a mounted widget rechecks about every 30 seconds. A change shows within about a minute.
data-fallback text if you set one.service_unavailable. Wait for Retry-After.data-title to something that fits your page.data-locale. English is the fallback.